Is there a Boost.Bimap alternative in c++11?

前端 未结 2 1069
野性不改
野性不改 2020-12-18 18:01

Is there a usable alternative to Boost\'s bimap in C++0x?

I would like to avoid Boost, but fully embrace C++11. If necessary, a slimmed down version of Boost\'s bima

2条回答
  •  盖世英雄少女心
    2020-12-18 18:36

    Short answer: no.

    Long answer: nope.


    It should be noted that C++14's support for transparent comparators eliminates the need for Boost.Bimap 90% of the time*: when you need to key off of any given property of an object (stored or computed), often a simple, bitwise-comparable unique identifier inherent to/present in the object anyway. With transparent comparators, you can compare an object to any possible value, discriminated only by type, as long as said value can be obtained/computed from an object without mutating it.

    * a guesstimate, not a statistic

提交回复
热议问题