Re: [Boost-bugs] [Boost C++ Libraries] #11801: Recursive modify in multi_index sometimes does not update index correctly

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11801: Recursive modify in multi_index sometimes does not update index correctly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-11-20 12:29:16


#11801: Recursive modify in multi_index sometimes does not update index correctly
-------------------------------------+-------------------------------------
  Reporter: Valentyn Shtronda | Owner: joaquin
  <valiko.ua@…> | Status: closed
      Type: Bugs | Component: multi_index
 Milestone: To Be Determined | Severity: Problem
   Version: Boost 1.59.0 | Keywords: multi_index
Resolution: invalid | multi_index_container recursive
                                     | modify
-------------------------------------+-------------------------------------

Comment (by Valentyn Shtronda <valiko.ua@…>):

> ''`mod(e)` does not invoke any operation of the `multi_index_container`
 except possibly only before `e` is directly modified, and only as long as
 `position` is not rendered invalid.''
 Not very clear. I had to re-read it several times and think for some time
 to get it. It's very conservative and I understand you. But multi_index is
 more powerful than allowed by this statement (it's ok to call find on
 unaffected indices, it's ok to use trick with re-indexing), at least at
 the moment :)

 The problem was caused by modification of '''key fields''' of '''more than
 one element''' (and thus made their position invalid) before container got
 chance to re-position the latest one, and this may be done incorrectly.

 So I would re-state it somehow more straightforward. How about this draft:

 ''Modification of key fields in `e` makes corresponding indices
 temporarily broken, until `modify()` returns. If you need to restore them
 sooner than `modify()` returns (for example, for recursive calls to
 `modify()`) wrap modification of key fields in its own call to `modify()`.

 And/or give a link to some example where you could provide more verbose
 explanation of the problem and solution.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11801#comment:9>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC