how boost multi_index is implemented

后端 未结 3 551
情话喂你
情话喂你 2020-12-30 01:55

I have some difficulties understanding how Boost.MultiIndex is implemented. Lets say I have the following:

typedef multi_index_container<
    employee,
           


        
3条回答
  •  有刺的猬
    2020-12-30 02:38

    Actually I do not think it is.

    Based on what is located in detail/node_type.hpp. It seems to me that like a std::map the node will contain both the value and the index. Except that in this case the various indices differ from one another and thus the node interleaving would actually differ depending on the index you're following.

    I am not sure about this though, Boost headers are definitely hard to parse, however it would make sense if you think in term of memory:

    • less allocations: faster allocation/deallocation
    • better cache locality

    I would appreciate a definitive answer though, if anyone knows about the gore.

提交回复
热议问题