
Vladimir Voronkov
Hi,
I defined a container like this:
typedef boost::multi_index_container< std::pair
, boost::multi_index::indexed_by< boost::multi_index::random_access<>, boost::multi_index::ordered_unique< boost::multi_index::member< std::pair , int, &std::pair ::first> IdContainer;
typedef IdContainer::nth_index<0>::type IdsArr; typedef IdContainer::nth_index<1>::type IdsSet;
and then I insert a data into it: a_set.insert(std::make_pair(1, 0)); a_set.insert(std::make_pair(3, 0)); a_set.insert(std::make_pair(2, 0)); a_set.insert(std::make_pair(5, 0)); a_set.insert(std::make_pair(4, 0));
in this case elements will be “pushed back” in terms of random access index [...] I would like to have them inserted ordered way, and as long as we have ordered index I suppose it’s possible. How can I do that?
I can think of two ways:
a)
void insert_in_place(IdContainer& a,const std::pair