diff --git a/doc/tutorial.md b/doc/tutorial.md index 1211023..379e6e3 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -280,7 +280,7 @@ A very special decision during design of RapidJSON is that, assignment of value ~~~~~~~~~~cpp Value a(123); Value b(456); -b = a; // a becomes a Null value, b becomes number 123. +a = b; // a becomes number 456, b becomes a Null value. ~~~~~~~~~~ ![Assignment with move semantics.](diagram/move1.png) @@ -305,7 +305,7 @@ Value o(kObjectType); ![Copy semantics makes a lots of copy operations.](diagram/move2.png) -The object `o` needs to allocate a buffer of same size as contacts, makes a deep clone of it, and then finally contacts is destructed. This will incur a lot of unnecessary allocations/deallocations and memory copying. +The object `o` needs to allocate a buffer of same size as `contacts`, makes a deep clone of it, and then finally `contacts` is destructed. This will incur a lot of unnecessary allocations/deallocations and memory copying. There are solutions to prevent actual copying these data, such as reference counting and garbage collection(GC). diff --git a/doc/tutorial.zh-cn.md b/doc/tutorial.zh-cn.md index 37808b0..156dab6 100644 --- a/doc/tutorial.zh-cn.md +++ b/doc/tutorial.zh-cn.md @@ -280,7 +280,7 @@ Value a(kArrayType); ~~~~~~~~~~cpp Value a(123); Value b(456); -b = a; // a变成Null,b变成数字123。 +a = b; // a变成数字456,b变成Null。 ~~~~~~~~~~ ![使用移动语意赋值。](diagram/move1.png) @@ -304,7 +304,7 @@ Value o(kObjectType); ![复制语意产生大量的复制操作。](diagram/move2.png) -那个`o` Object需要分配一个和contacts相同大小的缓冲区,对conacts做深度复制,并最终要析构contacts。这样会产生大量无必要的内存分配/释放,以及内存复制。 +那个`o` Object需要分配一个和contacts相同大小的缓冲区,对`contacts`做深度复制,并最终要析构`contacts`。这样会产生大量无必要的内存分配/释放,以及内存复制。 有一些方案可避免实质地复制这些数据,例如引用计数(reference counting)、垃圾回收(garbage collection, GC)。