Skip to content

Commit 1ede098

Browse files
committed
Workaround of sortkeys example
1 parent b94c2a1 commit 1ede098

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

example/sortkeys/sortkeys.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ int main() {
4242
}
4343
*/
4444

45+
// C++11 supports std::move() of Value so it always have no problem for std::sort().
46+
// Some C++03 implementations of std::sort() requires copy constructor which causes compilation error.
47+
// Needs a sorting function only depends on std::swap() instead.
48+
#if __cplusplus >= 201103L || !defined(__GLIBCXX__)
4549
std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator());
50+
#endif
51+
4652
printIt(d);
4753

4854
/*

0 commit comments

Comments
 (0)