Commit b52e0782 authored by Milo Yip's avatar Milo Yip

Try to add erase-remove idiom in unit test but fail to compile on VC2013.

parent c3ad232c
#include "unittest.h" #include "unittest.h"
#include "rapidjson/document.h" #include "rapidjson/document.h"
#include <algorithm>
using namespace rapidjson; using namespace rapidjson;
...@@ -674,6 +675,22 @@ TEST(Value, Array) { ...@@ -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() // SetArray()
Value z; Value z;
z.SetArray(); z.SetArray();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment