Boost logo

Boost Users :

Subject: Re: [Boost-users] std::list customization
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2010-01-30 13:48:59


Steven Watanabe wrote:
> AMDG
>
> Etienne Philip Pretorius wrote:
>> I know this is not boost specific, but I would appreciate any
>> comments about the following.
>>
>> I have a specific set of values stored in a std::list<unsigned char>.
>> As expected I can delete and add items anywhere, since I am using the
>> std::list object rearrange its own contents. But here is the problem
>> - when I have already decided that item at position 13 should always
>> remain at position 13 if the list has 13 or more objects in it...
>>
>> If I remove an item from the beginning then the item at position 13
>> becomes the item at position 12, while this is undesired - the effect
>> of shifting everything else on by one value is desired.
>>
>> Some examples of what I require:
>>
>> Fixed position marked with [].
>>
>> a,b,c,[d],e,f
>>
>> pop_front() is called
>>
>> b,c,e,[d],f
>>
>> This list object should also work when inserting items and keep those
>> with fixed positions at their position if the object size allows it.
>>
>> Any suggestions, Ideas on how to implement this would be greatly
>> appreciated.
>
> You could use Boost.Intrusive to superimpose a second list
> containing just the fixed position elements. You'll have to
> implement wrappers for all the mutating operations that do
> appropriate fixing up.
>
> In Christ,
> Steven Watanabe
>
Thank you, looks exactly what I need.
Etienne

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net