Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-12-09 13:38:12


Thomas Witt wrote:
> David Abrahams wrote:
>
>> Eric Niebler wrote:
>>
>>>
>>> Rationale:
>>> Given some iterator of type T that is built of an unknown number of
>>> adaptors, extract the underlying iterator. Consider:
>>>
>>> template<class Iter>
>>> typename disable_if<is_adapted<Iter>,Iter>::type
>>> base(Iter const & it)
>>> {
>>> return it;
>>> }
>>>
>>> template<class D,class B,class V,class T,class R,class Di>
>>> ??????????
>>> base(iterator_adaptor<D,B,V,T,R,Di> const & it)
>>> {
>>> return base(it.base());
>>> }
>>>
>>> I can't think of a way to write the return type of the second overload.
>
>
>
> I am not fully awake yet, but isn't that just B ?
>
> Thomas
>

Good morning, Thomas! :-) If I were just returning it.base() then it
would be B. Since I'm returning base(it.base()), it could be B or it
could be some other type if B is itself an adapted iterator.

I don't know how I've managed to get this far in life without knowing
how to create a patch file. :-P I'll figure it out and submit one.

-- 
Eric Niebler
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