types/traits: move inner_type to the util namespace

This commit is contained in:
Danny Robson 2018-08-01 17:18:59 +10:00
parent e92f0dc337
commit 00c46e0f9a

View File

@ -349,28 +349,30 @@ template <typename T>
constexpr auto is_contiguous_v = is_contiguous<T>::value; constexpr auto is_contiguous_v = is_contiguous<T>::value;
/////////////////////////////////////////////////////////////////////////////// namespace util {
/// stores the type of '::value_type' for a given type, or the type itself if ///////////////////////////////////////////////////////////////////////////////
/// it does not have such a type. /// stores the type of '::value_type' for a given type, or the type itself if
template <typename ValueT, typename = std::void_t<>> /// it does not have such a type.
struct inner_type { template <typename ValueT, typename = std::void_t<>>
using type = ValueT; struct inner_type {
}; using type = ValueT;
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename ValueT> template <typename ValueT>
struct inner_type< struct inner_type<
ValueT, ValueT,
std::void_t<typename ValueT::value_type> std::void_t<typename ValueT::value_type>
> { > {
using type = typename ValueT::value_type; using type = typename ValueT::value_type;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename ValueT> template <typename ValueT>
using inner_type_t = typename inner_type<ValueT>::type; using inner_type_t = typename inner_type<ValueT>::type;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////