问题描述
自从我开始使用这个网站以来,我一直在听说 Boost 库.我想知道 Boost 库的一些主要优点是什么(因此我为什么要使用它)以及 Boost 库的可移植性如何?
Since I have started using this site, I keep hearing about the Boost library. I am wondering what are some of the major benefits of the Boost library (hence why should I use it) and how portable is the Boost library?
推荐答案
Boost 是由标准委员会的几个成员组织的.
因此,它是下一个标准中图书馆的温床.
Boost is organized by several members of the standard committee.
So it is a breeding ground for libraries that will be in the next standard.
- 它是 STL 的扩展(它填补了被遗漏的部分)
- 有据可查.
- 经过同行评审.
- 它的活跃度很高,因此可以快速发现并修复错误.
- 它是平台中立的,适用于任何地方.
- 可以免费使用.
随着 tr1 即将推出,很高兴知道 boost 已经涵盖了很多领域.tr1 中的很多库基本上都是直接从 boost 原版改编而来的,因此已经过尝试和测试.不同之处在于它们已移入 std::tr1 命名空间(而不是 boost).
With tr1 coming up soon it is nice to know that boost already has a lot of the ground covered. A lot of the libraries in tr1 are basically adapted directly from boost originals and thus have been tried and tested. The difference is that they have been moved into the std::tr1 namespace (rather than boost).
您需要做的就是将以下内容添加到默认编译器 包括搜索路径:
All that you need to do is add the following to your compilers default include search path:
<boost-install-path>/boost/tr1/tr1
然后当你包含标准头文件时,boost 会自动将所有需要的东西导入命名空间 std::tr1
Then when you include the standard headers boost will automatically import all the required stuff into the namespace std::tr1
要使用 std::tr1::share_ptr,您只需要包含 <memory>.这将为您提供一个文件的所有智能指针.
To use std::tr1::share_ptr you just need to include <memory>. This will give you all the smart pointers with one file.
这篇关于升压库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!