为什么一些包含文件只驻留在tr1? [英] Why some include files only reside in tr1?

查看:158
本文介绍了为什么一些包含文件只驻留在tr1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试包含< unordered_map> 时,它会失败,并说文件不存在,而当我尝试包括 < tr1 / unordered_map> 它工作。然而,找到了存在于c ++ 03中的include文件,并且是c ++ 11(如< vector> 有移动构造函数)。另外,只有在c ++ 11而不在tr1中的头文件通常也会找到,例如< thread>

这是新的在tr1只是被投入tr1文件夹,一切进入正常包括。

为什么会发生这种情况?在不修改源文件的情况下是否有任何修复?

-I / path /传递到/ include / tr1 将无法工作,因为一切都在

我使用的编译器是

When I try to include things like <unordered_map> it fails and says the file doesn't exist, while when I try to include <tr1/unordered_map> it works. however, the include files that are present also in c++03 are found, and are c++11 (like <vector> has move constructor). Also, headers that are only in c++11 and not in tr1 are found normally as well, like <thread>.
Its like everything that was new in tr1 was just thrown into tr1 folder and everything else into normal include.
Why is this happening? Is there any fix to it without modifying source files?
Passing -I/path/to/include/tr1 won't work because everything is in the tr1 namespace.
The compiler I'm using is

Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)


推荐答案

TR1(技术报告1)不是标准,而只是报告。这是一种让人们知道委员会对这一领域感兴趣的官方方式。任何tr1实现是一个实验版本,旨在获得现场反馈,以改善未来的标准。

TR1 (technical report 1) is not a standard, but merely a report. It is an official way of letting people know that the committee is interested in this area. Any tr1 implementation is an experimental release aimed at getting field feedback for the purpose of bettering a future standard.

使用Apple的Xcode 4.2,你可以选择一个几乎完整的C ++ 11通过搜索您的构建设置为libc ++,然后选择libc ++作为C ++标准库(它不是默认值)。

Using Apple's Xcode 4.2 you can choose a nearly complete C++11 library by searching your build settings for "libc++" and then choose "libc++" as the C++ Standard Library (it is not the default).

或者如果你喜欢命令你可以使用-stdlib = libc ++。

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

libc ++不包含任何tr1组件,但包含除了原子>

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

这篇关于为什么一些包含文件只驻留在tr1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆