aboutsummaryrefslogtreecommitdiff
path: root/example/sortkeys/sortkeys.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'example/sortkeys/sortkeys.cpp')
-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);
/*