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

前端 未结 5 831
广开言路
广开言路 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:21

    #include will get you next-standard C++ unique hash container. Usage:

    std::tr1::unordered_map my_map;
    my_map["answer"] = 42;
    printf( "The answer to life and everything is: %d\n", my_map["answer"] );
    

提交回复
热议问题