[英]How do I know which C++ standard version I should use to build which version of Boost?
When you download the Boost sources, there's no indication of which C++ language standard version you should be using to build it. 下载Boost源代码时,没有迹象表明您应该使用哪种C ++语言标准版本来构建它。 But - clearly there's no auto-selection, since if you don't set, say, at least
--std=c++11
then some configuration checks for C++11 features fail. 但是 - 显然没有自动选择,因为如果你没有设置,比如至少
--std=c++11
那么对C ++ 11功能的一些配置检查就会失败。 So it's up to you, the builder, to set that. 因此,建筑师可以自行决定。
But - how do I know which C++ standard version to use for which Boost version? 但是 - 我如何知道哪个C ++标准版本用于哪个Boost版本? Is there like a table somewhere?
某处有桌子吗?
Specifically, I just built Boost 1.62.0 with --std=c++14 and got innumerable warnings about the use of sts::auto_ptr
which is deprecated. 具体来说,我刚刚使用--std = c ++ 14构建了Boost 1.62.0,并且有关使用不推荐使用的
sts::auto_ptr
无数警告。 So, should I have stuck with C++11? 那么,我应该坚持使用C ++ 11吗? How can I tell?
我该怎么说?
Unfortunately, some boost developers haven't updated their implementation with the newest standards (even C++11) with the problems that you present. 不幸的是,一些提升开发人员没有使用最新标准(甚至是C ++ 11)更新他们的实现,并解决了您提出的问题。 There is a boost_config set of macros that can be used for keeping up with compatibility.
有一组boost_config宏可用于保持兼容性。
But usually the problem with the compilers is using an older one not newer. 但通常编译器的问题是使用较旧的编译器而不是更新版本。
Warnings are no errors. 警告没有错误。 C++14 supports std::auto_ptr with no restrictions.
C ++ 14支持std :: auto_ptr,没有任何限制。 So you can use C++14, but you should not use std::auto_ptr in your new code.
所以你可以使用C ++ 14,但你不应该在新代码中使用std :: auto_ptr。 You should also not use std::auto_ptr with C++11.
您也不应该将std :: auto_ptr与C ++ 11一起使用。 EDIT: Since the OP didn't get the glue.
编辑:由于OP没有得到胶水。 If both support it, it makes no difference and he can use which one he likes.
如果两者都支持它,它没有任何区别,他可以使用他喜欢的那个。
Dont know about the Boost but you can get the c++ version from any c++ compiler like this - 不知道Boost但你可以从任何c ++编译器获得c ++版本 -
if( __cplusplus == 201103L ) std::cout << "C++11 " ;
if( __cplusplus == 199711L ) std::cout << "C++98 " ;
//... like this
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.