miloyip 最近的时间轴更新
miloyip

miloyip

V2EX 第 113895 号会员,加入于 2015-04-28 13:14:08 +08:00
miloyip 最近回复了
2016-02-05 09:38:17 +08:00
回复了 iambic 创建的主题 问与答 请问一个 rapidjson 使用问题
RapidJSON 允许一个 Object 内有相同的 Key ,在 `AddMember()` 里不作检查。
`Document` 在 consturctor 中不给与 allocator 的时候,是自行建立一个 allocator 。那么 `Parse()` 的时候会用该 allocator 来分配内存。所以两个 block 的 第一个 block 中的 `Document d2` 在离开 block 时, allocator 会连同其分配的内存同时失效。因此之后 d 里会有 dangling pointer 。
解决方法是让 d2 采用 d 的 allocator :`Document d2(&alloc);`。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2232 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 05:53 · PVG 13:53 · LAX 22:53 · JFK 01:53
Developed with CodeLauncher
♥ Do have faith in what you're doing.