Boost logo

Boost Users :

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


Hi,

I am trying to modify members of all elements matching value for a given
index in a boost.multiindex container

index.modify(
  index.find(value),
  [](T& element) { ... }
)

seems to update a singular element(first match)

On the other hand,
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?



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