Reputation: 2309
Code:
#include <string>
#include <boost/format.hpp>
int main() {
boost::format fmt;
auto str = fmt % L"";
}
Errors:
1>D:.conan\a9fe50\1\include\boost\format\alt_sstream_impl.hpp(261,1): error C2660: 'std::allocator::allocate': function does not take 2 arguments 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xmemory(838,65): message : see declaration of 'std::allocator::allocate' 1>D:.conan\a9fe50\1\include\boost\format\alt_sstream_impl.hpp(228): message : while compiling class template member function 'int boost::io::basic_altstringbuf<Ch,Tr,Alloc>::overflow(int)' 1>
with 1> [ 1> Ch=char, 1>
Tr=std::char_traits, 1> Alloc=std::allocator 1> ] 1>D:.conan\a9fe50\1\include\boost\format\format_class.hpp(173): message : see reference to class template instantiation 'boost::io::basic_altstringbuf<Ch,Tr,Alloc>' being compiled 1>
with 1> [ 1> Ch=char, 1>
Tr=std::char_traits, 1> Alloc=std::allocator 1> ] 1>D:\Documents\source\repos\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.cpp(6): message : see reference to class template instantiation 'boost::basic_format<char,std::char_traits,std::allocator>' being compiled 1>Generating Code... 1>Done building project "ConsoleApplication3.vcxproj" -- FAILED.
I upgraded VC++ today from 16.9 to 16.10, then compilation was broken.
It only happens when I use std:c++latest
, but works fine with 'std:c++17'.
Upvotes: 3
Views: 1333
Reputation: 30038
You can define _HAS_DEPRECATED_ALLOCATOR_MEMBERS
It will reenable the removed "allocator stuff" in C++20 even when you compile with C++20 standard selected.
Upvotes: 0
Reputation: 121
I realize this is a few months old now, but I just hit this same issue with boost 1.70 after upgrading VS 2019. All I did was remove the 2nd argument to the 'allocate' call on line 261 of alt_sstream_impl.hpp, since it's just a hint/optimization that was deprecated in c++ 17, and now gone in c++ 20. Fortunately, it's an inline method, so no linker issues.
Upvotes: 1
Reputation: 393114
The library lacks c++20 support (see https://en.cppreference.com/w/cpp/memory/allocator/allocate)
You can, for now, opt for c++17 compilation. Also, see whether they know about this issue, and if not report it to the developers.
wformat
Upvotes: 2