Boost logo

Boost Users :

Subject: [Boost-users] std::list customization
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2010-01-30 12:45:53


Hello List,

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.

Kind Regards,
Etienne


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