USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.2k stars 754 forks source link

Problem serializing objects with custom deleters/allocators #198

Open MerrillCornish opened 9 years ago

MerrillCornish commented 9 years ago

When cereal serializes smart pointers, it takes no notice of whether that object has a custom deleter or allocator. That means than when a smart pointer with non-default deleter or allocator is de-serialized, it's not going to behave the same as the original version.

At a minimum, cereal should raise an exception if a smart pointer with non-default deleter or allocator is submitted for serialization.

A similar problem exists with STL containers. Most (all?) of them allow customer allocators. So they should raise an exception also.

James2022-rgb commented 8 years ago

This seemed impossible or excruciatingly hard at best on Boost.Serialization so I'm trying out cereal instead, but looking at this issue, it doesn't seem to support it out of the box either. But I'm guessing cereal would be considerably easier to extend than Boost.Serialization. Has someone else tried use use custom allocators/deleters with cereal ?