Boost logo

Boost :

Subject: Re: [boost] [fusion] pop_back doesn't work on fwd sequences
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-08-11 05:08:21


On 8/11/2011 12:19 PM, Eric Niebler wrote:
> On 8/10/2011 3:06 PM, Joel de Guzman wrote:
>> On 8/11/2011 4:04 AM, Joel de Guzman wrote:
>>
>>> Hmmmm. now that I think about it, it is also possible to change the
>>> implementation of pop_back to make it so that it would not need
>>> to use 'prior'. The end iterator can be abstracted such that it
>>> compares equal to i through next(i). I'll see if that works out.
>>
>> Yep. It works like a charm. I have a fix. Now this works:
>>
>> {
>> list<int, int> l(1, 2);
>> std::cout << pop_back(l) << std::endl;
>> BOOST_TEST((pop_back(l) == make_list(1)));
>> }
>>
>> Now, indeed, the docs works as advertized.
>>
>> Thanks for your nudging, Eric. I truly appreciate it. You get my
>> neurons humming. Committed to trunk. I'd welcome a quick review
>> before I make this official.
>
> Very clever! Looks good to me.

Cool. Now I notice that pop_back_iterator is the workings of a
reusable iterator_adapter.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com

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