Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to FAQ: How to clear-and-minimize a document? #372

Merged
merged 1 commit into from
Jun 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@

Some applications use 64-bit unsigned/signed integers. And these integers cannot be converted into `double` without loss of precision. So the parsers detects whether a JSON number is convertible to different types of integers and/or `double`.

8. How to clear-and-minimize a document or value?

* Call one of the `SetXXX()` methods - they call destructor which deallocates DOM data:

```
Document d;
...
d.SetObject(); // clear and minimize
```

* Alternatively, use equivalent of the [C++ swap with temporary idiom](https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Clear-and-minimize):
```
d.Swap(Value(kObjectType).Move())
```

## Document/Value (DOM)

1. What is move semantics? Why?
Expand Down