繁体   English   中英

使用/ std:c ++最新版(或C ++ 17 / N4190)使用MSVC2015编译boost

[英]Compiling boost with MSVC2015 with /std:c++latest (or C++17/N4190)

当我尝试使用/std:c++latest标志使用MSVC2015构建boost时出现错误:

boost\algorithm\string\detail\case_conv.hpp(33): error C2143: syntax error: missing ',' before '<'

哪个指向:

 // a tolower functor
 template<typename CharT>
 struct to_lowerF : public std::unary_function<CharT, CharT>

现在这似乎是由于这里提到的N4190: https ://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs

/ std:c ++ latest还控制删除以下旧功能:N4190“删除auto_ptr,random_shuffle()和旧东西”,P0004R1“删除不推荐的Iostreams别名”,LWG 2385“function :: assign allocator argument doesn” “有意义”,以及各种非标准特性(std :: tr1命名空间,一些TR1专用机制和std :: identity结构)。

使用时:

 std::string a,b;
 return boost::iequals(a,b);

并使用boost::ilexicographical_compare

它也在这里提到:

https://blogs.msdn.microsoft.com/vcblog/2015/06/19/c111417-features-in-vs-2015-rtm/

 Stephan T. Lavavej - MSFT Azarien: Removing auto_ptr/etc. will have positive consequences. It will prevent new code from using outdated/complicated/unsafe 

机器,它将减少非专家用户之间的混淆。 (例如,不必要的unary_function / binary_function继承是常见的 ,因为许多用户认为STL算法/容器需要这个,而实际上只有过时的适配器。)而auto_ptr特别不安全,因为它的变异“复制”构造函数默默地移动来自左撇子。

那么如何使用VC2015的/ std:c ++最新版进行编译? 现在看来,boost不兼容C ++ 17吗?

在包含任何标头之前定义宏_HAS_AUTO_PTR_ETC 对于您自己的代码,如果您使用的是Visual Studio的构建系统,最好通过项目的预处理程序定义设置来完成 要构建Boost本身,请将define=_HAS_AUTO_PTR_ETC添加到b2 / bjam调用中。

可以通过定义宏_HAS_FUNCTION_ASSIGN_HAS_OLD_IOSTREAMS_MEMBERS_HAS_TR1_NAMESPACE来控制/std:c++latest隐式禁用的其他先前标准功能。 以下博客文章中概述了这些宏:

STL修复了VS 2015 Update 3
VS 2015 Update 2的STL是C ++ 17-so-far功能完整版

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM