coord/traits: expand value_trait to support scalars

This commit is contained in:
Danny Robson 2020-03-16 14:13:02 +11:00
parent 29e876c712
commit 7261bd7776

View File

@ -114,7 +114,6 @@ namespace cruft {
template <typename T> template <typename T>
constexpr auto has_scalar_op_v = has_scalar_op<T>::value; constexpr auto has_scalar_op_v = has_scalar_op<T>::value;
template <class> struct is_coord : std::false_type { }; template <class> struct is_coord : std::false_type { };
template <typename T> struct is_coord<const T> : is_coord<T> {}; template <typename T> struct is_coord<const T> : is_coord<T> {};
@ -229,6 +228,19 @@ namespace cruft {
struct value_trait<cruft::vector<S,T>> struct value_trait<cruft::vector<S,T>>
{ using value_type = T; }; { using value_type = T; };
template <typename ValueT>
requires requires {
typename ValueT::value_type;
}
struct value_trait<ValueT> {
using value_type = typename ValueT::value_type;
};
template <typename ValueT>
requires std::is_arithmetic_v<ValueT>
struct value_trait<ValueT> {
using value_type = ValueT;
};
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
template <typename OuterT> template <typename OuterT>