Boost logo

Boost Users :

Subject: Re: [Boost-users] [MultiIndex] Prevent automatic re-indexing after "modify"?
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2016-12-14 09:22:49


On Wed, Dec 14, 2016 at 3:00 PM, Leon Mlakar <leon_at_[hidden]> wrote:

>
> Therefore, my question really is:
>>
>> Is it possible to provide an "unsafe_modify" function, which does the
>> same as "modify" but does not trigger automatic re-indexing, and an
>> "refresh_index" function, which (manually) triggers the re-indexing?
>>
>>
> I second this idea. Hit the same issue not so long ago. Or event better,
> something like modify_range(<first>, <last>, <modifier>) that would
> automatically re-index after modifying entire range thus avoiding the
> danger of user forgetting to re-index.
>

If it takes <first>, <last>, it's not a range :) Joking apart, better to
accept anything that range-for can accept, and use Boost.Range to adapt a
pair of iterators into an actual range.

Yes, a modify_range() or bulk_modify() or insert_better_name() would be
great.
But then you don't know which index needs to be rebuilt, so they must all
be rebuilt.
So a new API to do this could additionally explicitly spell out which ones
perhaps.
Although then nothing prevents other keys to be modified, breaking BMI
invariants.
But I for one would be willing to accept the risk for the performance
benefits. --DD

PS: The same applies to the current "scalar" modify I guess, which must
update all indices too.



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