efficient way to get key from std::map value

后端 未结 4 1957
旧时难觅i
旧时难觅i 2021-01-18 00:46

I have a map as below :

std::map< std::string ,int> mapobj;
mapobj[\"one\"] = 1;
mapobj[\"two\"] = 2;
mapobj[\"three\"] =3 ;

how to g

4条回答
  •  情话喂你
    2021-01-18 01:01

    Try boost Bimap. all the things you are trying to do can simply be done by it.

    1 --> one 2 --> two ... one --> 1 two --> 2 ...

    here is a link where a working example is present. here

提交回复
热议问题