Boost logo

Boost :

From: dan marsden (danmarsden_at_[hidden])
Date: 2006-05-10 16:04:23


Larry Evans
>The boost/fusion/iterator/equal_to.hpp has:
>
> operator==(Iter1 const&, Iter2 const&)
> {
> return result_of::equal_to<Iter1, Iter2>::value;
> }
>
>Obviously only the types are compared and not the values.
>Shouldn't the values be compared as well? I've got my own
>tuple implementation where I need to compare the types
>as well as values. To do this it looks like I have to
>specialize the above operator==. Was this intended, or
>is there some better way to do what I need?
>

I believe that the position of a fusion iterator must be encoded in
the information available at compile. This is needed for fusion sequences
to serve as conforming MPL sequences (and probably various other things).
I've not needed any runtime comparisons in any of the sequences I've implemented,
although I must admit I found the definition of operator== surprising to start off with.

Can you post some code or a summary of the design you are using?

With regard to the ability of fusion sequences to act as MPL sequences, it looks
like there has been a bit of an omission in the documentation on that front...

#include <boost/fusion/sequence/intrinsic/mpl.hpp>

may provide a starting point to get the general idea of the MPL stuff if you are interested,
until we get chance to update the docs (assuming I'm not just failing to find the relevant section at the moment).

Cheers
Dan


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