Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-05-15 18:24:47


Joel de Guzman wrote:
> Tobias Schwinger wrote:
>>
>>Interesting. Just curious: how would you mask "nullaries" whith a non-member template function?
>
> You don't. It just works because templates are delayed.

Of course! Confused me.

>>Something different (that sentence just brought it back to my mind):
>>
>>I noticd that fusion::pair<end>(begin) works quite well as a "compound
>>iterator" but has a pretty uncool interface. A wrapper around it could
>>give a useful utility...
>>
>> 'in' is of type fusion::pair<end>(pos),
>> '==>' denotes interface transformation provided by an imaginary wrapper
>>
>> *in.second ==> *in
>> equal_to<typename In::first_type, typename In::second_type> ==> eoi<In>
>>
>>Since this thing knows when it's at the end, it could (BTW) even have an
>>operator-> that disappears in this case...
>
> I'd refrain from commenting right now because I realized I might
> have been wrong.

OK. Then I wouldn't need an "end iterator" for a full iteration and could
ask the *one* iterator whether it's at the end, right?

> I think now that Dave is correct that we can
> detect an iterator pointing nowhere and simply return void_ or
> something like I did above for Phoenix.

Yeah. But for my vote: I'd rather live without 'operator->' if it costs me
more template instantiations per iteration frame.
Further it's probably even more consistent to enforce explicit
dereferentiation, so runtime code is kept in sync with result computation
code (we'd have to use result_of::deref there, anyway).

> Thanks!

My pleasure.

Regards,

Tobias


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