Fixes empty string serialization for debug in VS (#69)

Previously we took the address of the dereferenced begin() iterator
on a string to get the pointer to its data; we now just const_cast
the pointer that is the result of calling data().

The original reason for using the iterator over something like data()
was to avoid the const_cast and to ensure that any copy on write
mechanisms were used, but this doesn't seem necessary given that we
call resize() immediately prior to this.  Valgrind shows no problems
with the new method.  Also added unit tests for this case to string.
This commit is contained in:
Shane Grant
2014-03-08 11:08:48 -08:00
parent 196822ef9f
commit 970aa9f07d
3 changed files with 8 additions and 3 deletions

View File

@@ -32,7 +32,7 @@
#include <cereal/types/vector.hpp>
#include <cereal/archives/binary.hpp>
//#include <cereal/archives/portable_binary.hpp>
#include <cereal/archives/portable_binary.hpp>
#include <cereal/archives/xml.hpp>
#include <cereal/archives/json.hpp>