multi_index_map icon indicating copy to clipboard operation
multi_index_map copied to clipboard

Sequenced index

Open redboltz opened this issue 7 months ago • 2 comments

Boost.MultiIndex has a sequenced index feature: https://www.boost.org/doc/libs/1_88_0/libs/multi_index/doc/reference/seq_indices.html

This allows elements to be accessed in insertion order. It's useful for certain queue-like structures. If multi_index_map supported it, I would be able to remove an element by a key (Hash or BTree), even if that element is in the middle of the queue. Do you have any plans to support this feature?

redboltz avatar May 10 '25 04:05 redboltz

Hi, yes I think this is actually fairly simple to implement. There is no "non-unique" version of a sequenced ordering, therefore it is simply a matter of swapping out the HashMap or BTreeMap lookup index for a Vec or VecDeque depending on what performance characteristics we want. I'll have a look when I have some time.

lun3x avatar May 20 '25 16:05 lun3x

Thank you for your response. I'm currently using indexmap.

  • https://docs.rs/indexmap/latest/indexmap/
  • https://github.com/indexmap-rs/indexmap

However, having multiple indexes along with insertion order would clearly be much more powerful and useful.

redboltz avatar May 22 '25 10:05 redboltz