
On 8/10/2011 12:56 PM, Eric Niebler wrote:
The documented requirement of pop_back are wrong. The docs say that pop_back works on Forward Sequences, however the following does not compile:
// ERROR fusion::list<int, int> l(1, 2); fusion::pop_back(l);
The problem is that the implementation of pop_back uses prior, which only works on Bidirectional Sequences.
That's merely a doc problem, but this is a more serious problem:
// ERROR fusion::pop_back(fusion::pop_back( fusion::push_back(fusion::push_back(fusion::nil(), 1), 2)));
A sequence created by push_back is a Forward Sequence, which means you can't call pop_back on it. I think that's a serious shortcoming. Fusion needs something like MPL's Back Extensible and Front Extensible concepts.
http://www.boost.org/doc/libs/1_47_0/libs/mpl/doc/refmanual/back-extensible-...
Unfortunately, this would likely require a redesign of the whole (push|pop)_(front|back) mechanism.
Man, this is a major bummer, alright. One plausible clean way I can think of is: 1) Make single_view random_access (if it's not already; IIRC No). 2) Make joint_view assume the least sequence category of its subsumed sequences. There's already some work done related to this where joint_view inherits the 'associative'-ness of its held sequences. I think this is an implementable clean solution. I'll see if I can work on it. Yours is a good test case. Thanks for noticing this, Eric! Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com