diff options
author | Milo Yip <miloyip@gmail.com> | 2019-02-11 14:14:35 +0800 |
---|---|---|
committer | Milo Yip <miloyip@gmail.com> | 2019-02-11 14:14:35 +0800 |
commit | 1ede098e90d93e74aa6cbfdc5d2d0c37ea608aca (patch) | |
tree | f2853628f07b47b8e800d780c6c0330a2fda928b | |
parent | b94c2a12033362ec41ca5e5d65fb9d3e10da16e8 (diff) | |
download | rapidjson-1ede098e90d93e74aa6cbfdc5d2d0c37ea608aca.tar.gz |
Workaround of sortkeys example
-rw-r--r-- | example/sortkeys/sortkeys.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/example/sortkeys/sortkeys.cpp b/example/sortkeys/sortkeys.cpp index 72a6410..c473784 100644 --- a/example/sortkeys/sortkeys.cpp +++ b/example/sortkeys/sortkeys.cpp @@ -42,7 +42,13 @@ 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__) std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator()); +#endif + printIt(d); /* |