Use std::iterator_traits to detect iterators, when possible.

This allows next/prior to detect user's iterators that do not
define iterator_category nested type but specialize
std::iterator_traits instead.
This commit is contained in:
Andrey Semashev 2017-07-23 20:29:25 +03:00
parent 792d0538d2
commit 2722fdcda3

View File

@ -52,7 +52,16 @@ struct is_iterator
};
template< typename T >
struct is_iterator< T, typename enable_if_has_type< typename T::iterator_category >::type >
struct is_iterator<
T,
typename enable_if_has_type<
#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS)
typename std::iterator_traits< T >::iterator_category
#else
typename T::iterator_category
#endif
>::type
>
{
static BOOST_CONSTEXPR_OR_CONST bool value = true;
};