Subject: Re: [boost] [type_traits] Interest in is_iterator type trait?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2014-08-20 09:24:50
On 20/08/14 14:33, Peter Dimov wrote:
> 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.
Alternatively, Boost could provide a boost::iterator_traits that always
behaves like C++14's (and would even be an alias to std::iterator_traits
This would be more clean to me that the code posted above.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk