Accessing map value by index

前端 未结 6 2055
时光取名叫无心
时光取名叫无心 2020-12-01 14:34

If I have a structure like

std::map myMap;
myMap[\"banana\"] = 1;
myMap[\"apple\"] = 1;
myMap[\"orange\"] = 1;

How can I

6条回答
  •  旧巷少年郎
    2020-12-01 14:56

    you can use some other map like containers .
    keep a size fields can make binary search tree easy to random access .
    here is my implementation ...
    std style , random access iterator ...
    size balanced tree ...
    https://github.com/mm304321141/zzz_lib/blob/master/sbtree.h
    and B+tree ...
    https://github.com/mm304321141/zzz_lib/blob/master/bpptree.h

提交回复
热议问题