Closed GoogleCodeExporter closed 8 years ago
The error is currently intentional, as copying of values is not allowed.
With the enhancement proposal available in my personal GitHub fork [1] to add
an explicit copy constructor (with an allocator), you can explicitly copy the
filtered values to the destination document:
Document dst(kArrayType), src;
load_values(src);
for (Value::ConstIterator it=src.Begin(), it!=src.End(); ++it)
if (0 == *it.GetInt() % 2) { // only even values
Value copy(*it,dst.GetAllocator);
dst.PushBack(copy,dst.GetAllocator());
}
I agree that the error message could be improved by adding a SFINAE condition
for types supported by PushBack<T>.
hth,
Philipp
[1] https://github.com/pah/rapidjson/pull/2 (description)
https://github.com/pah/rapidjson/compare/svn/trunk...value-copy-from.diff (patch)
Original comment by philipp....@gmail.com
on 7 Apr 2014 at 1:24
Fixed in https://github.com/miloyip/rapidjson/pull/20
Original comment by milo...@gmail.com
on 13 Jul 2014 at 4:45
Original issue reported on code.google.com by
lex.a...@gmail.com
on 3 Jan 2014 at 10:38