From 1ede098e90d93e74aa6cbfdc5d2d0c37ea608aca Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Mon, 11 Feb 2019 14:14:35 +0800 Subject: [PATCH] Workaround of sortkeys example --- example/sortkeys/sortkeys.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); /*