From 51a31ce006f7dfb850771688fe6a2ccdfcf765af Mon Sep 17 00:00:00 2001 From: Sfinktah Bungholio Date: Sun, 25 Sep 2016 20:36:33 +1000 Subject: [PATCH] Fix for winmindef.h defining min/max macros --- include/rapidjson/document.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 19f5a6a5f..6b9d9ef87 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -29,6 +29,14 @@ RAPIDJSON_DIAG_PUSH #ifdef _MSC_VER RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data +#ifdef _MINWINDEF_ // see: http://stackoverflow.com/questions/22744262/cant-call-stdmax-because-minwindef-h-defines-max +#ifndef NOMINMAX +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max +#endif +#endif #endif #ifdef __clang__ @@ -2570,6 +2578,12 @@ class GenericObject { }; RAPIDJSON_NAMESPACE_END +#ifdef _MINWINDEF_ // see: http://stackoverflow.com/questions/22744262/cant-call-stdmax-because-minwindef-h-defines-max +#ifndef NOMINMAX +#pragma pop_macro("min") +#pragma pop_macro("max") +#endif +#endif RAPIDJSON_DIAG_POP #endif // RAPIDJSON_DOCUMENT_H_