Boost logo

Boost Users :

Subject: Re: [Boost-users] Container with insertion order
From: Igor R (boost.lists_at_[hidden])
Date: 2011-11-23 14:35:26


> but if I would simulate a std::map I should add another field in structure,
> to store the "value" of the map .. is correct?

Yes, you can add a "key" field to the struct, and then define ordered
unique index on it.
Note that when accessing multi_index_container you say explicitly
which index you're working with. So, when you're working with
random_access<> index, you'll get the items in the order of insertion,
but when you switch to another (eg. ordered) index, you get the items
in another order.


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