diff --git a/pytorch3d/csrc/point_mesh/point_mesh.cpp b/pytorch3d/csrc/point_mesh/point_mesh.cpp index 59e5cefb..3480a801 100644 --- a/pytorch3d/csrc/point_mesh/point_mesh.cpp +++ b/pytorch3d/csrc/point_mesh/point_mesh.cpp @@ -11,38 +11,32 @@ template vec3 ExtractPoint(const at::TensorAccessor& t) { - return vec3(t[0], t[1], t[2]); + return vec3(t[0], t[1], t[2]); } -template -struct ExtractHullHelper { - template - static std::array>, H> - get(const Accessor& t); +template +static std::array>, 1> +ExtractHullHelper(const Accessor& t, std::array /*tag*/) { + return {ExtractPoint(t)}; +} - template <> - static std::array>, 1> - get<1>(const Accessor& t) { - return {ExtractPoint(t)}; - } +template +static std::array>, 2> +ExtractHullHelper(const Accessor& t, std::array /*tag*/) { + return {ExtractPoint(t[0]), ExtractPoint(t[1])}; +} - template <> - static std::array>, 2> - get<2>(const Accessor& t) { - return {ExtractPoint(t[0]), ExtractPoint(t[1])}; - } - - template <> - static std::array>, 3> - get<3>(const Accessor& t) { - return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])}; - } -}; +template +static std::array>, 3> +ExtractHullHelper(const Accessor& t, std::array /*tag*/) { + return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])}; +} template std::array>, H> ExtractHull(const Accessor& t) { - return ExtractHullHelper::template get(t); + std::array tag; + return ExtractHullHelper(t, tag); } template