|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-03-02 15:36:49
"Thorsten Ottosen" <nesotto_at_[hidden]> writes:
> "Alisdair Meredith" <alisdair.meredith_at_[hidden]> wrote in message
> news:3E6232BB.80B6D0FE_at_uk.renaultf1.com...
>> Thorsten Ottosen wrote:
>>
>> > 2. many standard algorithms take a single output iterator as an
> argument.
>> > Currently the argument for output must be a container. Should
>> > it be posible to specify an iterator here too?
>>
>> Absolutely! Not all iterators belong to containers eg ostream_iterator
>
> I see your point. Does anyone have a nice idea of how to detect when the
> template argument is an iterator?
Sadly, there is no reliable way. The closest thing I can imagine is
to use SFINAE to check that iterator_traits<T> has valid types, and
that the types are consistent with the iterator requirements.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk