Boost logo

Boost :

Subject: Re: [boost] [type_traits] Interest in is_iterator type trait?
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2014-08-19 12:38:10


On Aug 19, 2014, at 11:55 AM, Peter Dimov <lists_at_[hidden]> wrote:

> Beman Dawes wrote:
>> The intent was always to submit is_iterator to Boost, but we never got around to it. Now I need it in Boost.Filesystem, so I'd rather see it go in type traits than just sticking it into boost/filesystem/detail.
>
> Out of curiosity, why do you need it?

Fwiw, I used something closely related in libc++ for SFINAE on the “member template members” of the containers (the ones taking iterators) to disambiguate them from the members/constructors not taking iterators, but having the same number of parameters. But instead of is_iterator, I needed is_input_iterator, is_forward_iterator, etc. These refinements are implemented similar to what Beman shows, but takes into account which std iterator tag the nested iterator_category type is implicitly convertible to.

They can also be used instead of tag dispatching for the selection of an optimal algorithm.

Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk