|
Boost Users : |
Subject: Re: [Boost-users] Container with insertion order
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2011-11-23 08:19:08
2011/11/23 Claude <clros_at_[hidden]>:
> I used this definition:
>
> typedef multi_index_container<
> int,
> indexed_by<sequenced<> >
>> mySet;
>
> But this not preserve the insertion order.
> I think that my error is in "index_by<>"; it is true? How do I fix?
>
First of all: do you need key-value container (map/hash map)
or just sequential one (list/vector)?
If you need it to be both at the same time, multi-index is the way to
go then and you
need need 2 indices, ordered and sequenced, for example:
typedef multi_index_container<
std::string,
indexed_by<
sequenced<>,
ordered_unique<identity<std::string> >
>
> text_container;
Cheers,
Simon
-- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com
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