Boost logo

Boost Users :

Subject: Re: [Boost-users] Modifying all matching elements in a Boost.MultiIndex Container
From: Amit Prakash Ambasta (amit.prakash.ambasta_at_[hidden])
Date: 2015-12-31 16:54:27


I'd also like to point out that your approach via modify_unstable_range as
per the boost mailing list works correctly though (however you've commented
that it would be a slower approach)

On Fri, Jan 1, 2016 at 1:03 AM Joaquín M Lopez Munoz <joaquin_at_[hidden]> wrote:

> Amit Prakash Ambasta <amit.prakash.ambasta <at> gmail.com> writes:
>
> >
> > std::pair<index::iterator, index::iterator> iter =
> index.equal_range(value);
> >
> > while(iter.first != iter.second) {
> >
> >
> > index.modify(
> > iter.first,
> > [](T& element) { ... }
> > );
> >
> > iter.first++;
> > }
> >
> > leads to segfaults and unexpected behavior.
> >
> > What would be right way to approach this?
>
> This is a classic, please follow these links for further info:
>
> http://stackoverflow.com/questions/29013600/
>
> modifying-key-ranges-in-a-boost-multi-index-map-having-hashed-non-unique-keys
> http://lists.boost.org/boost-users/2006/03/18048.php
>
> Joaquín M López Munoz
> Telefónica
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



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