Boost logo

Boost :

Subject: Re: [boost] [type_traits] Interest in is_iterator type trait?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2014-08-19 13:00:14


On Tue, 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?
>

Like Howard, for SFINAE. The specific case is implementing the Filesystem
TS, which in class path has this:

        template <class Source>
        path(const Source& source);

Source can be a iterator to a NTCTS or a container. The value_type may be
one of 5 char types, and may be the same or different from the value_type
of the path. There are six path members templated on Source. I can reduce
all that complexity to this implementation for the ctor, and then reused
detail::append() to implement the five other member functions.

{
   detail::append(source, m_pathname);
}

detail::append() has four overloads. enable_if using is_iterator<>
distinguishes which overload should be selected.

--Beman


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