mirror of https://github.com/davisking/dlib.git
update docs
This commit is contained in:
parent
ab346ddfa6
commit
20a1477209
|
@ -49,9 +49,19 @@
|
||||||
For convenience, you can also serialize to a file using this syntax:
|
For convenience, you can also serialize to a file using this syntax:
|
||||||
serialize("your_file.dat") << some_object << another_object;
|
serialize("your_file.dat") << some_object << another_object;
|
||||||
|
|
||||||
|
// or to a memory buffer.
|
||||||
|
std::vector<char> memory_buffer;
|
||||||
|
serialize(memory_buffer) << some_object << another_object;
|
||||||
|
|
||||||
|
// or some other stream
|
||||||
|
std::ostringstream memory_buffer2;
|
||||||
|
serialize(memory_buffer2) << some_object << another_object;
|
||||||
|
|
||||||
That overwrites the contents of your_file.dat with the serialized data from some_object
|
That overwrites the contents of your_file.dat with the serialized data from some_object
|
||||||
and another_object. Then to recall the objects from the file you can do:
|
and another_object. Then to recall the objects from the file you can do:
|
||||||
deserialize("your_file.dat") >> some_object >> another_object;
|
deserialize("your_file.dat") >> some_object >> another_object;
|
||||||
|
// or from a memory buffer or another stream called memory_buffer.
|
||||||
|
deserialize(memory_buffer) >> some_object >> another_object;
|
||||||
|
|
||||||
Finally, you can chain as many objects together using the << and >> operators as you
|
Finally, you can chain as many objects together using the << and >> operators as you
|
||||||
like.
|
like.
|
||||||
|
|
Loading…
Reference in New Issue