Why are some included files only in tr1?

When I try to include things like <unordered_map> , it fails and says that the file does not exist, and when I try to include <tr1/unordered_map> , it works. however, include files are also present in C ++ 03, and are C ++ 11 (for example, <vector> has a move constructor). In addition, headers that are found only in C ++ 11 and not in tr1, such as <thread> , are usually displayed.
He, like everything that was new in tr1, was simply thrown into the tr1 folder, and everything else is normal. Why is this happening? Is there any fix without modifying the source files?
Passing -I/path/to/include/tr1 will not work because everything is in the tr1 namespace.
The compiler I'm using

 Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn) 
+7
source share
3 answers

TR1 (Technical Report 1) is not a standard, but simply a report. This is the official way to let people know that the committee is interested in this area. Any tr1 implementation is a pilot release aimed at getting feedback from the fields to improve the future standard.

Using Apple Xcode 4.2, you can select the nearly complete C ++ 11 library by searching for the build settings for "libC ++" and then select "libC ++" as the standard C ++ library (this is not the default).

Or, if you prefer the command line, you can -stdlib = libC ++.

libC ++ does not contain any tr1 components, but contains all C ++ 11 except for <atomic> .

+10
source

Add the following parameters to clang ++:

 -std=c++11 -stdlib=libc++ 
+6
source

Yes, different compilers interpret TR1 headers differently. GCC, for example, does the same as you, and MVS accepts <unordered_map> . One way around this is to use boost/tr1/unordered_map.hpp if you need a cross platform or compilation of multiple compilers.

+1
source

All Articles