On Wed, Nov 2, 2022 at 10:05 PM Joaquin M López Muñoz <joaquinlopezmunoz@gmail.com> wrote:
Insert+modify works fine as far as I can see:
[...]
Your particular problem hints at the more general issue that Boost.MultiIndex indices do not have
something like try_emplace, which is the semantics you're after. The reason why this function
is not available is that we have set-like indices, not map-like indices.
[...]
Hi,
Thanks for the response.
Yes, you are right, I'm looking for an API with semantics like try_emplace and now
I understand the complications for it for the case of boost multi_index.
I'm currently using emplace + modify API. My initial question was not very clear about this.
However, my understanding is that the modify call will try to reposition the node because
it can't be sure if the user callback hasn't changed something in the entry which wouldrequire repositioning of the node in any of the indices.
Is my understanding of the modify API correct?
As I'm using hashed + sequenced indices, I know that setting only the mapped_type
in the modify call won't cause any repositioning in the both of the above indices.
Thus I was trying to avoid the additional work which happens internally in the modify call.
BTW, thanks for working on boost::unordered_flat_map because it'll allow us to remove
3rd party dependency from our projects as we are currently using
Glad to hear about that! It'd be great if you could download the
upcoming beta and provide
early feedback before Boost 1.81 ships.
Joaquín M López Muñoz