|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-05-04 15:07:37
Joel de Guzman <joel_at_[hidden]> writes:
> So MPL is not sequence preserving after all.
It really depends what you mean by "sequence preserving." If it
returned the same type, it couldn't really do anything. So you have
to decide how many guarantees you're going to give about the result
type. Andy wants it to be spelled as a specialization of the same
template, so transform operating on mpl::vector<t1,t2,t3> would yield
something spelled mpl::vector<t1a,t2a,t3a>.
> transform merely returns a sequence with the same properties as the
> original. This makes perfect sense. In Fusion, algorithms are not
> sequence preserving by design. However, we do have conversion
> functions/metafunctions to get a *true* vector/list/set/map from an
> arbitrary sequence.
No, I don't think that would satisfy Andy, because you're surely not
guaranteeing that the result type will be spelled
fusion::list<t1,t2,t3,...>
or you wouldn't be able to do this to lists of arbitrary length (and
why else use a list, after all?). You probably have to conjure up
something spelled cons<t1,cons<t2,cons<t3,nil> > >, which, while it's
a "true list", it isn't a specialization of fusion::list. Which
leaves fusion right back in the same place as MPL. Unless I'm missing
something, of course ;-)
-- 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