programming-with-cpp20 icon indicating copy to clipboard operation
programming-with-cpp20 copied to clipboard

Fixed the compiler error of C2664

Open 007havegone opened this issue 1 year ago • 1 comments

Env Viual studio 17 2022, cmake 3.30.4 After using the cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_COMPILER=cl to genetor the build directory and sln file. Complie will meet this error

error C2664: 'auto std::make_format_args<std::format_context,const std::string,double,const T,const T>(const std::string &,double &,const T &,const T &)': cannot convert argument 2 from 'double' to 'double &

Add the menber function to solve this problem.

007havegone avatar Oct 03 '24 20:10 007havegone

Hello @007havegone,

Thanks for the fix! I'd like to think a moment about what to do here. While your fix is great and correct, the source code presented in the book and the explanation no longer match.

Andreas

andreasfertig avatar Oct 14 '24 07:10 andreasfertig