Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using unordered_map of C++0x

I am using an unordered_map which is included as: #include <unordered_map> and the program is compiled as follows: g++ Test.cc -std=gnu++0x -o test Am I using the unordered_map of TR1 or that of C++0x. Or is it both the same?

like image 694
softwarematter Avatar asked May 10 '11 00:05

softwarematter


2 Answers

I believe gcc puts their TR1 headers in <tr1/unordered_map>, so you should be getting the C++11 version. But they are very similar.

like image 188
Howard Hinnant Avatar answered Oct 12 '22 03:10

Howard Hinnant


GCC has tr1 headers in tr1 subdirectory. Plus there is the tr1 namespace.

#include <tr1/unordered_map>
...
std::tr1::unordered_map<...>(...);

So unless you specifically did these things or did a similar "using" you've got the std ones.

The implementations are split but they are rather similar. There were just enough differences (initializer_list, comparison ops) to make maintenance of one file with all the conditionals and macros a pain.

like image 31
emsr Avatar answered Oct 12 '22 03:10

emsr