boost bcp——namespace到底做了什么?
What does boost bcp --namespace really do?
我的印象是,带有名称空间选项的boost bcp意味着为任何列出的模块重命名包含和定义。在运行该工具并检查输出后,它似乎没有这样做。如果它们仍然是#include <boost/*>
,并且期望最终用户的#include <boost/*>
不会引起版本冲突,我该如何重新分发它们?它只是用名称空间闭包包装这些吗?
我使用了以下bcp命令:
.boost_1_53_0distbinbcp.exe --boost=boost_1_53_0 --namespace=myboost --namespace-alias smart_ptr filesystem array.hpp container move ptr_container algorithm/string.hpp tokenizer.hpp thread chrono atomic foreach.hpp build myboost
快速grep文件生成:
[boost]grep -e "boost/" algorithmstring.hpp
grep -e "boost/" algorithmstring.hpp
#include <boost/algorithm/string/std_containers_traits.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/find_iterator.hpp>
我很确定这是带有名称空间选项的bcp工具的用例,然而,我显然误解了一些常见的c++概念/用法,对吗?或者,也许是我错误地使用了这个工具?
提前感谢您的建议。
BCP——namespace=myboost——namespace-alias regex config build/foo
复制完整的regex库(在libs/regex中)加上配置库(libs/config)和构建系统(tools/build)到/foo,包括所有依赖项。还将boost命名空间重命名为myboost,并将二进制库的文件名更改为以前缀"myboost"而不是"boost"开头。——namespace-alias选项使命名空间boost成为新名称的别名。
只有二进制文件将被重命名(libboost_regex.so
将是libmyboost_regex.so
),而不是头文件。另外,命名空间boost
将被myboost
取代(boost
将成为myboost
的别名)。
如其名称所示,它重命名命名空间和库文件(即。dll和。libs),但不重命名头文件所在的目录,因此不重命名include。
Boost库通常位于namespace boost
中。使用bcp将该名称空间更改为myboost
。例如,下面的代码是有效的:
#include <boost/sharedptr.hpp> //header directories haven't changed
myboost::shared_ptr<int> pi = myboost::make_shared<int>(5); //but the namespace has
多亏了--namespace-alias
,您可以继续使用命名空间boost,因为boost
已经成为myboost
的别名:
boost::shared_ptr<int> pi; //ok, this is in fact a myboost::shared_ptr
参见文档中的示例:http://www.boost.org/doc/libs/1_53_0/tools/bcp/doc/html/index.html
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 警告处理为错误这里有什么问题
- 什么时候调用组成单元对象的析构函数
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 什么时候在C++中返回常量引用是个好主意
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- C++避免重复声明的语法是什么
- c++库的公共头文件中应该包含什么
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- ifstream什么都没读
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- C++从另一个类访问公共静态向量的正确方法是什么
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- 我应该使用什么来代替void作为变体中的替代类型之一
- boost bcp——namespace到底做了什么?