diff --git a/types/traits.hpp b/types/traits.hpp index f5a9a6c3..1826889d 100644 --- a/types/traits.hpp +++ b/types/traits.hpp @@ -294,9 +294,18 @@ using nth_argument_t = typename nth_argument::type; /////////////////////////////////////////////////////////////////////////////// +/// A trait that tests if a type `T` is a container type. +/// +/// That is, a type that has: +/// * container typedefs such as value_type, reference, iterator, etc. +/// * viable std::begin/std::end overloads +/// +/// Defaults to false. template > struct is_container : public std::false_type {}; + +///---------------------------------------------------------------------------- template struct is_container< T, @@ -307,15 +316,14 @@ struct is_container< typename T::iterator, typename T::const_iterator, typename T::difference_type, - typename T::size_type + typename T::size_type, + decltype(std::end (std::declval ())), + decltype(std::begin (std::declval ())) > > : public std::true_type {}; -template -struct is_container> : public std::true_type {}; - - +//----------------------------------------------------------------------------- template constexpr auto is_container_v = is_container::value;