constexpr initialization of array to sort contents
It’s ugly, and probably not the best way to sort in a constant expression (because of the required instantiation depth).. but voilà, a merge sort: Helper type, returnable array type with constexpr element access: #include <cstddef> #include <iterator> #include <type_traits> template<class T, std::size_t N> struct c_array { T arr[N]; constexpr T const& operator[](std::size_t p) const … Read more