Reputation: 29248
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?
Upvotes: 5
Views: 3343
Reputation: 477600
This depends very much on the particular compiler version. For instance, GCC 4.4 basically just had some macro switches for your -std=c++0x
option to do the namespace labelling appropriately, but would always end up pulling the actual code from tr1_impl/unordered_map
, while GCC 4.6 has two entirely separate implementations, one in tr1/unordered_map.h
and one in bits/unordered_map.h
-- and the respective base class implementations in .../hashtable.h
do in fact differ; the C++0x version has std::forward
s everywhere etc.
Short answer: It depends.
Upvotes: 0
Reputation: 16373
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.
Upvotes: 3
Reputation: 219438
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.
Upvotes: 6