aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2019-02-11 14:14:35 +0800
committerMilo Yip <miloyip@gmail.com>2019-02-11 14:14:35 +0800
commit1ede098e90d93e74aa6cbfdc5d2d0c37ea608aca (patch)
treef2853628f07b47b8e800d780c6c0330a2fda928b
parentb94c2a12033362ec41ca5e5d65fb9d3e10da16e8 (diff)
downloadrapidjson-1ede098e90d93e74aa6cbfdc5d2d0c37ea608aca.tar.gz
Workaround of sortkeys example
-rw-r--r--example/sortkeys/sortkeys.cpp6
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);
/*