Boost logo

Boost :

Subject: [boost] [fusion] pop_back doesn't work on fwd sequences
From: Eric Niebler (eric_at_[hidden])
Date: 2011-08-10 00:56:43


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-sequence.html

Unfortunately, this would likely require a redesign of the whole
(push|pop)_(front|back) mechanism.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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