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

This commit is contained in:
Milo Yip 2014-08-01 00:04:31 +08:00
parent c3ad232c3e
commit b52e07822e

View File

@ -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();