Closed vtnerd closed 9 years ago
I wanted to point out that this code will fail in the following case:
typedef boost::flyweight<std::string, boost::flyweights::no_tracking> FlyString;
std::vector<byte> serialised{};
{
const FlyString test_string{"a test string"};
const std::shared_ptr<std::string> test_shared_ptr{
std::addressof(test_string.get()), []{}};
serialised = Serialise(test_string, test_shared_ptr);
}
{
FlyString test_string{};
std::shared_ptr<std::string> test_shared_ptr{};
Parse(serialised, test_string, test_shared_ptr); // runtime failure
}
So if this is unacceptable, reject this patch. That seems like a difficult case anyhow, because custom deleters never work with Cereal (since it always provides its own custom deleter).
Also ran these tests against valgrind in Ubuntu-14.04. No memory leaks or issues.