Added quickstart page

This commit is contained in:
Randolph Voorhies
2013-07-06 17:22:05 -07:00
parent cf940c0af8
commit df875c0b60
4 changed files with 192 additions and 7 deletions
+3 -2
View File
@@ -60,9 +60,10 @@ namespace cereal
return new MyType( x );
}
};
``
```
---
`
### Implementation notes
When saving an `std::shared_ptr`, we first check to make sure we haven't serialized it before. This is done by keeping a map from addresses to pointer ids (an `std::uint32_t`), which are unique. Pointers that are newly serialized are given a new id with the most significant bit set to `1`. When saved, an `std::shared_ptr` will first output its id, which will either have its MSB set to `1` if it is the first instance of that id, or will be an id already in the archive. This is immediately followed by the data found by dereferencing the pointer. If the pointer was equal to `nullptr`, its id is set to `0` and nothing else is saved.