如何从 boost 库中取出单个元素(例如共享指针)?
我一直在尝试一些 Boost 组件,我认为在我正在从事的项目中唯一直接需要的组件是 boost::shared_ptr
。
仅包含 shared_ptr
所需的文件,或者至少仅包含项目中的 Boost smart_ptr 目录的文件是否会很困难?它们似乎对 Boost 的其他部分有一些外部依赖 - 但我认为有一种简单的方法可以只使用 Boost 库的某些组件,但我缺少它。
如果您能告诉我需要哪些部分或为我指出一个好的教程,我将不胜感激!
I've been playing around with some Boost components, and the only one I see a direct need for in the project I'm working on is boost::shared_ptr
.
Would it be difficult to just include the required files for shared_ptr
, or at least just include files for the Boost smart_ptr directory in my project? They seem to have some external dependencies on other parts of Boost - but I figure there's an easy way to just use certain components of the Boost library and I'm missing it.
If you can tell me what parts I need or point me to a good tutorial I'd be most grateful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 bcp 工具仅提取所需的标头。
这会将
shared_ptr
和所有依赖项复制到目录 fooYou can use the bcp tool to extract only the header you want.
This copies
shared_ptr
and all dependencies to the directory foo您只能包含来自 boost 的shared_ptr标头,如下所示
,看一下基本示例 此处或查看更多示例此处
您可以在此包含 boost 库的几乎所有部分方式并且它几乎没有进一步的依赖项(仅适用于一些更复杂的库)
You can only include the shared_ptr headers from boost like this
look at a basic example here or for more examples here
you can include nearly every part of the boost lib in this way and it has nearly no further dependencies (only for some more complex libs)