#pragma once #include // forward declaration struct Plane2D; struct Plane3D; namespace detail { template struct deduce_plane_type { }; template <> struct deduce_plane_type<2> { using type = Plane2D; }; template <> struct deduce_plane_type<3> { using type = Plane3D; }; } // namespace detail template struct PlaneGroup { using PlaneType = typename detail::deduce_plane_type::type; PlaneGroup() = default; template PlaneGroup(InputIt first, InputIt last) { if constexpr (N == 2) { planes = small_vector_mp{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }; } else { planes = small_vector_mp{ {1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1} }; } planes.insert(planes.end(), std::make_move_iterator(first), std::make_move_iterator(last)); } template PlaneGroup(Container&& container) : PlaneGroup(std::begin(std::forward(container)), std::end(std::forward(container))) { } auto get_plane(uint32_t index) const noexcept { return planes[index]; } small_vector_mp planes{}; }; using PlaneGroup2D = PlaneGroup<2>; using PlaneGroup3D = PlaneGroup<3>;