Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-03 06:34:24

Andreas Huber <ahd6974-spamgroupstrap_at_[hidden]> writes:

> David Abrahams <dave <at>> writes:
> [snip]
>> > I need to modify that sequence internally.
>> You don't mean that, exactly, since all metadata is immutable.
> Right, I mean that I can't use e.g. push_front on some sequences.
>> > If any sequence was allowed (including immutable ones), I would need
>> > to copy that sequence into an mpl::list<> first.
>> Why an mpl::list<>? What's special about that structurue? Why not
>> mpl::vector?
> The sequence just needs to support certain operations, e.g. push_front,
> reverse, etc. So, mpl::vector<> should work too (I never checked).

If you're reversing the sequence, all your arguments about requiring
mutability for efficiency reasons are invalid. You might as well do

   mpl::reverse<user_sequence, back_inserter<vector<> > >
> Don't know, I can't think of anything that would keep you from using
> deque or vector. I guess it would be best to document the exact
> requirements and make measurements so that I can tell the user which
> of the standard mpl sequences are best.

Not a bad idea, but I wouldn't go overboard. In this case the first
priority should be to lift needless restrictions. The restrictions
you're using don't even neccessarily lead to better efficiency.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at