diff --git a/types/traits.hpp b/types/traits.hpp index 73e20c24..4e822294 100644 --- a/types/traits.hpp +++ b/types/traits.hpp @@ -328,4 +328,28 @@ struct is_contiguous>: public std::true_type {}; template constexpr auto is_contiguous_v = is_contiguous::value; + +/////////////////////////////////////////////////////////////////////////////// +/// stores the type of '::value_type' for a given type, or the type itself if +/// it does not have such a type. +template > +struct inner_type { + using type = ValueT; +}; + + +//----------------------------------------------------------------------------- +template +struct inner_type< + ValueT, + std::void_t +> { + using type = typename ValueT::value_type; +}; + + +//----------------------------------------------------------------------------- +template +using inner_type_t = typename inner_type::type; + #endif