diff --git a/coord/ops.hpp b/coord/ops.hpp index 52cab527..fb2163b2 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -931,6 +931,38 @@ namespace util { static_assert (I < S); return k[I]; }; + + + /// create a coord from supplied arguments, optionally specifying the + /// underlying type. + /// + /// much like experimental::make_array we use a void type to signal we + /// need to deduce the underlying type. +#define MAKE_COORD(KLASS) \ + template < \ + typename _T = void, \ + typename ...Args \ + > \ + auto \ + make_##KLASS (Args &&...args) \ + { \ + using T = std::conditional_t< \ + std::is_void_v<_T>, \ + std::common_type_t, \ + _T \ + >; \ + \ + return KLASS { \ + std::forward (args)... \ + }; \ + } + + MAKE_COORD(extent) + MAKE_COORD(point) + MAKE_COORD(colour) + MAKE_COORD(vector) + +#undef MAKE_COORD } diff --git a/extent.hpp b/extent.hpp index e972742a..cde8c587 100644 --- a/extent.hpp +++ b/extent.hpp @@ -83,30 +83,6 @@ namespace util { }; - /// create an extent from supplied arguments, optionally specifying the - /// underlying type. - /// - /// much like experimental::make_array we use a void type to signal we - /// need to deduce the underlying type. - template < - typename _T = void, - typename ...Args - > - auto - make_extent (Args &&...args) - { - using T = std::conditional_t< - std::is_void_v<_T>, - std::common_type_t, - _T - >; - - return extent { - std::forward (args)... - }; - } - - /////////////////////////////////////////////////////////////////////////// template extent_range