In the version 2.1.1, msvc generates a few warnings about std::numeric_limits<>::max() (and min) usage. This is because windows.h have their own min/max macros definitions in the global namespace (here is microsoft kb article about it..
warning exact text: warning C4003: not enough actual parameters for macro 'max'
possible fixes:
1)
#define NOMINMAX
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
- use additional parenthesis
std::numeric_limits<uint8_t>::max() => (std::numeric_limits<uint8_t>::max)()
First two methods can produce problems, due to use original windows min/max in the gdi and more.
the third method should be tested on the other compilers.
Source to reproduce the problem:
#include "stdafx.h"
#include "windows.h"
#include "json.hpp"
using json = nlohmann::json;
int main( int argc, char const *argv[] )
{
json j;
j[ "test" ] = 1;
}
In the version 2.1.1, msvc generates a few warnings about std::numeric_limits<>::max() (and min) usage. This is because windows.h have their own min/max macros definitions in the global namespace (here is microsoft kb article about it..
warning exact text: warning C4003: not enough actual parameters for macro 'max'
possible fixes:
1)
#define NOMINMAXstd::numeric_limits<uint8_t>::max() => (std::numeric_limits<uint8_t>::max)()
First two methods can produce problems, due to use original windows min/max in the gdi and more.
the third method should be tested on the other compilers.
Source to reproduce the problem: