I would like to see a hash_map example in C++

前端 未结 5 833
广开言路
广开言路 2020-12-08 03:41

I don\'t know how to use the hash function in C++, but I know that we can use hash_map. Does g++ support that by simply including #include

5条回答
  •  忘掉有多难
    2020-12-08 04:18

    The name accepted into TR1 (and the draft for the next standard) is std::unordered_map, so if you have that available, it's probably the one you want to use.

    Other than that, using it is a lot like using std::map, with the proviso that when/if you traverse the items in an std::map, they come out in the order specified by operator<, but for an unordered_map, the order is generally meaningless.

提交回复
热议问题