Hi, All,

 

I just have started using boost and have some questions, answers on that i couldn’t find in the documentation.

 

My interest is in using multi_index_container as combination of advantages of standard bidirectional list as well as fast lookup (insertion) of standard associative container (particularly set).

 

Let’s say we have the following definitions:

 

            typedef boost::multi_index_container<

                  UserInfo,

                  boost::multi_index::indexed_by<

                        boost::multi_index::sequenced<>,

                        boost::multi_index::ordered_unique<

                             boost::multi_index::identity<UserInfo>,

                             UserInfoLess> > >

            UsersContainer;

 

            typedef UsersContainer::nth_index<0>::type UsersList;

            typedef UsersContainer::nth_index<1>::type UsersSet;

 

 

Now we want to insert some value into this container the following way:

 

            UsersSet& setIndex = m_Users.get<1>();

            std::pair<UsersSet::iterator, bool> insRet = setIndex.insert(someVal);

 

The question is how can i acquire iterator of m_Users having the iterator UsersSet::iterator ?

Do iterators keep the property of set’s iterators that they remain valid after insertion of an element?

 

Thanks for the answers,

Vladimir Voronkov.