20 Aug
2014
20 Aug
'14
12:33 p.m.
Mathias Gaunard wrote:
AFAIK an iterator T doesn't have to provide an iterator_category typedef, only std::iterator_traits<T> does.
That's true. However, pre-C++14, iterator_traits<It>::iterator_category causes a hard error (not SFINAE) when It is not an iterator. In C++14, the default iterator_traits<It> is empty when It doesn't have the nested types. So is_iterator<It, tag> :- is_convertible<X::iterator_category, tag> where X is iterator_traits<It> in C++14, It otherwise is the best we can do.