Ask questionsmove document into value

After rapidjson::Document parsing rapidjson::StringStream and hold the DOM tree. Is it possible to move the DOM into a rapidjson::Value? I can't figure out how to do this, which means my API can not be symmetric when encoding and decoding into and from string. I currently use CopyFrom to get all the data out of rapidjson::Document into rapidjson::Value. But this create a deep copy ineffeciency which I believe RapidJSON's design principle is against.


Answer questions miloyip

How about using swapping?

    Document d;
    Value v;

But need to remind that the values in document is allocated by the document's allocator. Need to preserve the lifetime of document.


Related questions

是否支持流式解析以及多个json分离解析 hot 1
是否支持流式解析以及多个json分离解析 hot 1
RapidJSON causes cc1plus: internal compiler error: Segmentation fault - rapidjson hot 1
GenericMemberIterator::Iterator implicitly declared private when RAPIDJSON_NOMEMBERITERATORCLASS is defined hot 1
Always gets a core dump while creating json string (rapidjson) hot 1
Bazel Support hot 1
Syntax typo in tutorial hot 1
是否支持流式解析以及多个json分离解析 hot 1
作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量 hot 1
travis on windows hot 1
Added headers to my project and got thousands of errors hot 1
Added headers to my project and got thousands of errors hot 1
想要的反斜杠 \. 无法表示,否则JSON解析出错 hot 1
Assertion `stack_.GetSize() == sizeof(ValueType)' failed hot 1
Github User Rank List