什么是性病,TR1和提升之间的差异(如命名空间和/或库)? [英] What are differences between std, tr1 and boost (as namespaces and/or libraries)?
问题描述
我最初以为他们都是一样的,但事实证明是错误的。所以,任何人都可以简单介绍一下这三者之间的区别是什么?例如:
I initially thought they're all the same, but it turned out to be wrong. So can anyone briefly explain the differences between these three? For example:
-
的std ::绑定
(最新的一个,下一代C ++的) -
的std :: TR1 ::绑定
(旧,C的扩展++标准) -
的boost ::绑定
(完全独立的库)
std::bind
( newest one, next generation of C++ )std::tr1::bind
( old, extension of C++ std )boost::bind
( completely separate library )
或的std :: shared_ptr的
,的std :: TR1的:: shared_ptr的
和提高:: shared_ptr的
...等
更新
绑定
,的shared_ptr
就是例子,有助于澄清我的问题。我的目的是要了解这三个名称空间之间的一般区别。有迹象表明,存在于所有三种命名空间几个图书馆,显然绑定
就是一个例子,以及的shared_ptr
。
bind
, shared_ptr
are examples that help to clarify my question. My intention was to understand the general differences between those three namespaces. There are several libraries that exist in all three namespaces, and apparently bind
is one example, as well as shared_ptr
.
命名空间是什么,我应该坚持?我个人preFER库从的std ::
,因为这将是C的一个标准++(C ++ 0x中)。任何反馈会大大AP preciated!
What namespaces should I stick with? I personally prefer library from std::
since it will be the next standard of C++ ( C++0x ). Any feedback would be greatly appreciated!
谢谢,结果
陈
Thanks,
Chan
推荐答案
1 - 的std ::绑定
是它的标准名称。这将是您使用C ++ 11标准库的名称。在标准化的C ++ 所有库列表。
1 - std::bind
is the the standard name for it. This will be the name you use for C++11 compliant libraries. List of all libraries in standardized C++.
2 - 的std :: TR1 ::绑定
是C ++技术报告1命名空间。与C ++ 03和C ++ 11有在 C ++技术报告1 ,其中提出附加库和增强。大多数这些Boost中已经存在的时候,和其中的一些库的变化在C ++ 11标准被采纳,如<正则表达式>
和<功能>
(包含的std ::绑定
)。在的std :: TR1
命名空间被用来区分他们的工作正在进行中状态的库,而不是一切都在 STD 标准化code>命名空间。
2 - std::tr1::bind
is C++ Technical Report 1 namespace. Between C++03 and C++11 there was the C++ Technical Report 1, which proposed additional libraries and enhancements. Most of these already existed in Boost at the time, and some of these library changes were adopted in the C++11 standard, like <regex>
and <functional>
(which contains std::bind
). The std::tr1
namespace was used to differentiate the libraries in their work-in-progress state, as opposed to everything standardized in the std
namespace.
3 - 的boost ::绑定
是绑定
在升压
的命名空间,如果你正在使用的升压库。升压涵盖的不仅仅是什么是在TR1和我在C ++ 11的性病库等等。在升压所有库列表为1.52.0 的
3 - boost::bind
is for bind
in the boost
namespace, if you are using the Boost library. Boost encompasses much more than what is in TR1 and what i in C++11's std library. List of all libraries in Boost as of 1.52.0
大部分什么在TR1已经被标准化,并在C ++ 11 STD
命名空间,C ++ 11包含比TR1那名提到更多的图书馆改编自升压结构,像 中所定义线程支持;螺纹&GT;
。
Most of what was in TR1 has been standardized and is in the C++11 std
namespace, and C++11 contains more libraries than mentioned in TR1 that were adapted from Boost constructs, like threading support defined in <thread>
.
什么定义,你可以使用哪些,哪些空间可以使用的部分,现在取决于你的编译器。我不记得,但我认为更近的GCC-G ++实现都使用新的C ++ 11库 STD
命名空间启动,但可能需要不同的编译器标志以激活。他们仍然支持的std :: TR1
命名空间虽然。的Visual C ++ 2010感动是什么pviously $ P $在的std :: TR1
进入正常 STD
命名空间,但Visual C ++ 2008年仍在使用的std :: TR1
。
Part of what defines what you can use and which namespace you can use now depends on your compiler. I don't recall, but I think the more recent GCC-g++ implementations have started using std
namespaces for the new C++11 libraries, but might require a different compiler flag to activate that. They will still support the std::tr1
namespace though. Visual C++ 2010 moved what was previously in std::tr1
into the normal std
namespace, but Visual C++ 2008 still used std::tr1
.
这篇关于什么是性病,TR1和提升之间的差异(如命名空间和/或库)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!