Boost logo

Boost Users :

Subject: Re: [Boost-users] Modifying all matching elements in a Boost.MultiIndex Container
From: Joaquín M Lopez Munoz (joaquin_at_[hidden])
Date: 2015-12-31 14:33:03


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 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