2016-09-07 313 views
8

Khi tôi cố gắng xây dựng tăng với MSVC2015 với /std:c++latest cờ tôi nhận được một lỗi:Biên dịch tăng với MSVC2015 với/std: C++ mới nhất (hoặc C++ 17/N4190)

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

Những điểm để:

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

Bây giờ điều này dường như là do N4190 như đã đề cập ở đây: https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs

/std:c++latest also controls the removal of the following old features: N4190 "Removing auto_ptr, random_shuffle(), And Old Stuff", P0004R1 "Removing Deprecated Iostreams Aliases", LWG 2385 "function::assign allocator argument doesn't make sense", and various non-Standard features (the std::tr1 namespace, some TR1-only machinery, and the std::identity struct).

Khi sử dụng:

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

Và sử dụng boost::ilexicographical_compare.

của nó cũng đề cập ở đây:

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 

machinery, and it will reduce confusion among non-expert users. (For example, unnecessary unary_function/binary_function inheritance is common, because many users thought that STL algorithms/containers required this, when in fact only the outdated adapters did.) And auto_ptr in particular is unsafe, because its mutating "copy" constructor silently moves from lvalues.

Vậy làm thế nào để tôi có động lực để biên dịch với VC2015 của/std: C++ mới nhất? Ngay bây giờ nó xuất hiện tăng không phải là C++ 17 tương thích?

+0

Báo cáo vấn đề này .. http://www.boost.org/development/bugs.html .. https: // svn. boost.org/trac/boost/newticket – GrafikRobot

Trả lời

9

Xác định macro _HAS_AUTO_PTR_ETC trước khi bao gồm bất kỳ tiêu đề nào. Đối với mã của riêng bạn, nếu bạn đang sử dụng hệ thống xây dựng của Visual Studio, điều này được thực hiện tốt nhất theo cách của dự án của bạn là Preprocessor Definitions setting. Để tự xây dựng Boost, hãy thêm define=_HAS_AUTO_PTR_ETC vào số b2/bjam yêu cầu của bạn.

Chức năng chuẩn khác trước đây bị tắt hoàn toàn bởi /std:c++latest có thể được kiểm soát bằng cách xác định macro _HAS_FUNCTION_ASSIGN, _HAS_OLD_IOSTREAMS_MEMBERS_HAS_TR1_NAMESPACE. Những macro đều được nêu trong bài viết blog sau đây:

STL Fixes In VS 2015 Update 3
VS 2015 Update 2’s STL is C++17-so-far Feature Complete

Các vấn đề liên quan