• <small id='wwES9'></small><noframes id='wwES9'>

    <legend id='wwES9'><style id='wwES9'><dir id='wwES9'><q id='wwES9'></q></dir></style></legend>
    • <bdo id='wwES9'></bdo><ul id='wwES9'></ul>
    <tfoot id='wwES9'></tfoot>

        <i id='wwES9'><tr id='wwES9'><dt id='wwES9'><q id='wwES9'><span id='wwES9'><b id='wwES9'><form id='wwES9'><ins id='wwES9'></ins><ul id='wwES9'></ul><sub id='wwES9'></sub></form><legend id='wwES9'></legend><bdo id='wwES9'><pre id='wwES9'><center id='wwES9'></center></pre></bdo></b><th id='wwES9'></th></span></q></dt></tr></i><div id='wwES9'><tfoot id='wwES9'></tfoot><dl id='wwES9'><fieldset id='wwES9'></fieldset></dl></div>

        std、tr1 和 boost(作为命名空间和/或库)之间有什么区别?

        时间:2023-07-20
        <tfoot id='kMRDM'></tfoot>
        • <bdo id='kMRDM'></bdo><ul id='kMRDM'></ul>
        • <legend id='kMRDM'><style id='kMRDM'><dir id='kMRDM'><q id='kMRDM'></q></dir></style></legend>

              1. <small id='kMRDM'></small><noframes id='kMRDM'>

                <i id='kMRDM'><tr id='kMRDM'><dt id='kMRDM'><q id='kMRDM'><span id='kMRDM'><b id='kMRDM'><form id='kMRDM'><ins id='kMRDM'></ins><ul id='kMRDM'></ul><sub id='kMRDM'></sub></form><legend id='kMRDM'></legend><bdo id='kMRDM'><pre id='kMRDM'><center id='kMRDM'></center></pre></bdo></b><th id='kMRDM'></th></span></q></dt></tr></i><div id='kMRDM'><tfoot id='kMRDM'></tfoot><dl id='kMRDM'><fieldset id='kMRDM'></fieldset></dl></div>
                  <tbody id='kMRDM'></tbody>
                • 本文介绍了std、tr1 和 boost(作为命名空间和/或库)之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我最初认为它们都是一样的,但结果证明是错误的.那么谁能简单解释一下这三者之间的区别?例如:

                  1. std::bind(最新的,下一代C++)
                  2. std::tr1::bind(旧的,C++ std 的扩展)
                  3. boost::bind(完全独立的库)

                  std::shared_ptrstd::tr1::shared_ptrboost::shared_ptr、...等

                  更新

                  bindshared_ptr 是有助于澄清我的问题的示例.我的目的是了解这三个命名空间之间的一般差异.有几个库存在于所有三个命名空间中,显然 bindshared_ptr 就是一个例子.

                  我应该坚持使用哪些命名空间?我个人更喜欢 std:: 中的库,因为它将成为 C++ ( C++0x ) 的下一个标准.

                  解决方案

                  1 - std::bind 是它的标准名称.这将是您用于 C++11 兼容库的名称.所有标准化C++库的列表.

                  2 - std::tr1::bind 是 C++ 技术报告 1 命名空间.在 C++03 和 C++11 之间有 C++ 技术报告 1,其中提出了额外的库和增强功能.其中大部分在当时已经存在于 Boost 中,其中一些库更改被 C++11 标准采用,例如 (其中包含 std::bind).std::tr1 命名空间用于区分处于工作中状态的库,而不是在 std 命名空间中标准化的所有内容.

                  3 - boost::bind 用于 boost 命名空间中的 bind,如果您使用的是 Boost 库.Boost 包含的内容远不止 TR1 中的内容和 C++11 标准库中的内容.所有 截至 1.52.0 的 Boost 库列表>

                  TR1 中的大部分内容已经标准化并位于 C++11 std 命名空间中,并且 C++11 包含比 TR1 中提到的更多的库,这些库改编自 Boost 结构,例如 中定义的线程支持.

                  定义您可以使用的内容以及您现在可以使用的命名空间的部分内容取决于您的编译器.我不记得了,但我认为最近的 GCC-g++ 实现已经开始为新的 C++11 库使用 std 命名空间,但可能需要不同的编译器标志来激活它.不过,它们仍将支持 std::tr1 命名空间.Visual C++ 2010 将以前在 std::tr1 中的内容移动到普通的 std 命名空间中,但 Visual C++ 2008 仍然使用 std::tr1.

                  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:

                  1. std::bind ( newest one, next generation of C++ )
                  2. std::tr1::bind ( old, extension of C++ std )
                  3. boost::bind ( completely separate library )

                  or std::shared_ptr, std::tr1::shared_ptr, and boost::shared_ptr, ...etc

                  Update

                  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.

                  What namespaces should I stick with? I personally prefer library from std:: since it will be the next standard of C++ ( C++0x ).

                  解决方案

                  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::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::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

                  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>.

                  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.

                  这篇关于std、tr1 和 boost(作为命名空间和/或库)之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:理解 boost::disjoint_sets 下一篇:static_cast 和 Implicit_cast 有什么区别?

                  相关文章

                    <small id='tmiCb'></small><noframes id='tmiCb'>

                      <tfoot id='tmiCb'></tfoot>
                        <bdo id='tmiCb'></bdo><ul id='tmiCb'></ul>
                      <i id='tmiCb'><tr id='tmiCb'><dt id='tmiCb'><q id='tmiCb'><span id='tmiCb'><b id='tmiCb'><form id='tmiCb'><ins id='tmiCb'></ins><ul id='tmiCb'></ul><sub id='tmiCb'></sub></form><legend id='tmiCb'></legend><bdo id='tmiCb'><pre id='tmiCb'><center id='tmiCb'></center></pre></bdo></b><th id='tmiCb'></th></span></q></dt></tr></i><div id='tmiCb'><tfoot id='tmiCb'></tfoot><dl id='tmiCb'><fieldset id='tmiCb'></fieldset></dl></div>
                    1. <legend id='tmiCb'><style id='tmiCb'><dir id='tmiCb'><q id='tmiCb'></q></dir></style></legend>