Merge pull request #1502 from ylavic/compilation_fixes

Compilation fixes
This commit is contained in:
Milo Yip 2019-12-03 09:51:05 +08:00 committed by GitHub
commit dfbe1db9da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -45,9 +45,8 @@ int main() {
// C++11 supports std::move() of Value so it always have no problem for std::sort(). // 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. // Some C++03 implementations of std::sort() requires copy constructor which causes compilation error.
// Needs a sorting function only depends on std::swap() instead. // 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()); std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator());
#endif
printIt(d); printIt(d);
@ -59,4 +58,5 @@ int main() {
"zeta": false "zeta": false
} }
*/ */
#endif
} }

View File

@ -631,7 +631,8 @@ RAPIDJSON_NAMESPACE_END
#if RAPIDJSON_HAS_CXX11_NOEXCEPT #if RAPIDJSON_HAS_CXX11_NOEXCEPT
#define RAPIDJSON_NOEXCEPT_ASSERT(x) #define RAPIDJSON_NOEXCEPT_ASSERT(x)
#else #else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x) #include <cassert>
#define RAPIDJSON_NOEXCEPT_ASSERT(x) assert(x)
#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT #endif // RAPIDJSON_HAS_CXX11_NOEXCEPT
#else #else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x) #define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)

View File

@ -122,6 +122,9 @@ public:
#ifndef RAPIDJSON_ASSERT #ifndef RAPIDJSON_ASSERT
#define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u) #define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u)
#ifndef RAPIDJSON_ASSERT_THROWS
#define RAPIDJSON_ASSERT_THROWS
#endif
#endif #endif
class Random { class Random {