Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2014-07-31 20:04:31 +0400
committerMilo Yip <miloyip@gmail.com>2014-07-31 20:04:31 +0400
commitb52e07822e85ffff11012ce1b83423369ecbc935 (patch)
tree89d64bdfcabdbb50c5341e5d7e1f27c24d6a2abe /test
parentc3ad232c3e7cbfd8450184df09879705291d0958 (diff)
Try to add erase-remove idiom in unit test but fail to compile on VC2013.
Diffstat (limited to 'test')
-rw-r--r--test/unittest/valuetest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp
index 8655c852..2aa6379e 100644
--- a/test/unittest/valuetest.cpp
+++ b/test/unittest/valuetest.cpp
@@ -1,5 +1,6 @@
#include "unittest.h"
#include "rapidjson/document.h"
+#include <algorithm>
using namespace rapidjson;
@@ -674,6 +675,22 @@ TEST(Value, Array) {
}
}
+ // Working in gcc without C++11, but VS2013 cannot compile. To be diagnosed.
+#if 0
+ // http://en.wikipedia.org/wiki/Erase-remove_idiom
+ x.Clear();
+ for (int i = 0; i < 10; i++)
+ if (i % 2 == 0)
+ x.PushBack(i, allocator);
+ else
+ x.PushBack(Value(kNullType).Move(), allocator);
+
+ x.Erase(std::remove(x.Begin(), x.End(), Value(kNullType)), x.End());
+ EXPECT_EQ(5u, x.Size());
+ for (int i = 0; i < 5; i++)
+ EXPECT_EQ(i * 2, x[i]);
+#endif
+
// SetArray()
Value z;
z.SetArray();