diff --git a/example/sortkeys/sortkeys.cpp b/example/sortkeys/sortkeys.cpp index c4737849e..7ede9fb93 100644 --- a/example/sortkeys/sortkeys.cpp +++ b/example/sortkeys/sortkeys.cpp @@ -45,9 +45,8 @@ int main() { // C++11 supports std::move() of Value so it always have no problem for std::sort(). // Some C++03 implementations of std::sort() requires copy constructor which causes compilation error. // Needs a sorting function only depends on std::swap() instead. -#if __cplusplus >= 201103L || !defined(__GLIBCXX__) +#if __cplusplus >= 201103L || (!defined(__GLIBCXX__) && (!defined(_MSC_VER) || _MSC_VER >= 1900)) std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator()); -#endif printIt(d); @@ -59,4 +58,5 @@ int main() { "zeta": false } */ +#endif } diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h index b71ea79bd..329ce92be 100644 --- a/include/rapidjson/rapidjson.h +++ b/include/rapidjson/rapidjson.h @@ -631,7 +631,8 @@ RAPIDJSON_NAMESPACE_END #if RAPIDJSON_HAS_CXX11_NOEXCEPT #define RAPIDJSON_NOEXCEPT_ASSERT(x) #else -#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x) +#include +#define RAPIDJSON_NOEXCEPT_ASSERT(x) assert(x) #endif // RAPIDJSON_HAS_CXX11_NOEXCEPT #else #define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x) diff --git a/test/unittest/unittest.h b/test/unittest/unittest.h index 84c1b7348..0afac09cb 100644 --- a/test/unittest/unittest.h +++ b/test/unittest/unittest.h @@ -122,6 +122,9 @@ class AssertException : public std::logic_error { #ifndef RAPIDJSON_ASSERT #define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u) +#ifndef RAPIDJSON_ASSERT_THROWS +#define RAPIDJSON_ASSERT_THROWS +#endif #endif class Random {