
Hi again, Thanks for the answers, they helped my. Now I have come with some another probably stupid questions. I've changed the initial example by adding some attribute to the element. Let's say int. typedef std::string UserInfo; typedef std::less<std::string> UserInfoLess; typedef boost::multi_index_container< std::pair<UserInfo, int>, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::member<std::pair<UserInfo, int>, UserInfo, &std::pair<UserInfo, int>::first>, UserInfoLess>, boost::multi_index::ordered_non_unique< boost::multi_index::member<std::pair<UserInfo, int>, int, &std::pair<UserInfo, int>::second> > > > UsersContainer; typedef UsersContainer::nth_index<2>::type UsersSelected; This flag has not many possible values and most probably there will be many pairs in the container with the same value of this flag. Now I want to enumerate all values in the container with some specific value of this flag. There are many ways to do that. 1. Use lower_bound for getting iterator for the UsersSelected index. 2. implement own iterator that use some int value as a parameter. But the ideal solution would be to expose some kind of "view" of the container that behaves like list, so we could use it's iterator from begin() to end() taking only necessary elements. Is that possible? Thanks.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Joaquin M Lopez Munoz Sent: Tuesday, October 13, 2009 8:16 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] multi_index_comtainer questions
Andrew Holden <aholden <at> charteroaksystems.com> writes:
On Tuesday, October 13, 2009 9:53 AM, Vladimir Voronkov wrote:
Do iterators keep the property of set’s iterators that they remain valid after insertion of an element? [...]
As far as I know, all iterators to all indices of a multi-index remain valid unless they point to a deleted element.
This is correct.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users