You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Visual Studio seems not to have all min() function versions #581
I did not know that MSVC does not support the initializer-list version - according to cppreference it is C++11. Anyway, I shall replace it with the other version.
I should have added the error msgs and line number:
Error C2589 '(': illegal token on right side of '::' [...]\json.hpp 8936
Error C2059 syntax error: '::' LibSonarProc [...]\json.hpp 8936
it compiled for me when I changed std::min ->min
Wish I was using g++
Line 8936:
return std::string(start + offset, std::min(length, max_length - offset));
This fails to compile in VS2015 with the errors I show above.
If I change to this, it will compile:
return std::string(start + offset, min(length, max_length - offset));
C:\Program Files (x86)\Microsoft Visual Studio 14.0>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
Activity
gregmarr commentedon May 11, 2017
It should still be std::min, but yeah, I don't see any reason to use the initializer_list version instead of the two parameter version here.
nlohmann commentedon May 13, 2017
I did not know that MSVC does not support the initializer-list version - according to cppreference it is C++11. Anyway, I shall replace it with the other version.
🏁 fix for #581
nlohmann commentedon May 13, 2017
@j-k Could you please check if the fix works for you?
gregmarr commentedon May 14, 2017
I didn't know that it wouldn't support it either until this issue was posted. :)
guygee commentedon May 31, 2017
cloned today, had the same issue, the suggested fix in the first post worked.
VS2015 community V. 14.0.25420.1 compiling x86
nlohmann commentedon May 31, 2017
Thanks!
guygee commentedon May 31, 2017
I should have added the error msgs and line number:
Error C2589 '(': illegal token on right side of '::' [...]\json.hpp 8936
Error C2059 syntax error: '::' LibSonarProc [...]\json.hpp 8936
it compiled for me when I changed std::min ->min
Wish I was using g++
nlohmann commentedon May 31, 2017
I don't understand: I fixed this with commit 9b764ee. Does it still not work?
guygee commentedon Jun 1, 2017
Line 8936:
return std::string(start + offset, std::min(length, max_length - offset));
This fails to compile in VS2015 with the errors I show above.
If I change to this, it will compile:
return std::string(start + offset, min(length, max_length - offset));
nlohmann commentedon Jun 1, 2017
Which version of MSVC is this?
guygee commentedon Jun 4, 2017
C:\Program Files (x86)\Microsoft Visual Studio 14.0>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
nlohmann commentedon Jun 4, 2017
This version is not supported, see https://github.com/nlohmann/json#supported-compilers.
guygee commentedon Jun 4, 2017
OK, thank you.
nlohmann commentedon Jun 4, 2017
No worries. :)
guygee commentedon Jun 4, 2017
Just to be clear,
Version 19.00.24210 is the MS command-line compiler version,
as I posted above, the Visual Studio version is 2015, V. 14.0.25420.1
nlohmann commentedon Jun 4, 2017
This is strange - this version is supported. But AppVeyor has no issues building and executing the tests.
nlohmann commentedon Jun 5, 2017
I had another look: AppVeyor compiles the code without issues with Microsoft (R) Build Engine version 14.0.25420.1: https://ci.appveyor.com/project/nlohmann/json/build/job/74yfdd5tjwk0i7s1
Maybe this is related: #603