Commit 2f6387f2 authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

Restore C++14 compatibility

Summary: Fix the new CPU implementation of point_mesh functionality to be compatible with older C++.

Reviewed By: nikhilaravi

Differential Revision: D22066785

fbshipit-source-id: a245849342019a93ff68e186a10985458b007436
parent 74659aef
......@@ -11,38 +11,32 @@
template <typename T>
vec3<T> ExtractPoint(const at::TensorAccessor<T, 1>& t) {
return vec3(t[0], t[1], t[2]);
return vec3<T>(t[0], t[1], t[2]);
}
template <class Accessor>
struct ExtractHullHelper {
template <int H>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, H>
get(const Accessor& t);
template <>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 1>
get<1>(const Accessor& t) {
return {ExtractPoint(t)};
}
template <typename Accessor>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 1>
ExtractHullHelper(const Accessor& t, std::array<char, 1> /*tag*/) {
return {ExtractPoint(t)};
}
template <>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 2>
get<2>(const Accessor& t) {
return {ExtractPoint(t[0]), ExtractPoint(t[1])};
}
template <typename Accessor>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 2>
ExtractHullHelper(const Accessor& t, std::array<char, 2> /*tag*/) {
return {ExtractPoint(t[0]), ExtractPoint(t[1])};
}
template <>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 3>
get<3>(const Accessor& t) {
return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])};
}
};
template <typename Accessor>
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 3>
ExtractHullHelper(const Accessor& t, std::array<char, 3> /*tag*/) {
return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])};
}
template <int H, typename Accessor>
std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, H>
ExtractHull(const Accessor& t) {
return ExtractHullHelper<Accessor>::template get<H>(t);
std::array<char, H> tag;
return ExtractHullHelper(t, tag);
}
template <typename T>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment