mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
Making cereal play nicely when saving enable_shared_from_this
cereal no longer permanently modifies the state of internal workings of std::enable_shared_from_this when saving. cereal *should* be completely compatible with both saving and loading anything that inherits from this now. This fixes issue #68 - note that there is still a minor issue regarding classes declared final that will run into a bug with the way we check for enable_shared_from_this (see issue #65). Issue #65 will be addressed in the future by changing the way we check for derivation from enable_shared_from_this. In the current scheme, we can detect this even if you use protected inheritance. In the future, cereal will not be able to get around protected inheritance of enable_shared_from without befriending cereal::access. This will come at the benefit of allowing classes declared final to be used with polymorphic serialization.
This commit is contained in:
@@ -1262,6 +1262,8 @@ void test_memory_load_construct()
|
||||
oar( o_shared3 );
|
||||
}
|
||||
|
||||
o_shared3->shared_from_this(); // tests github issue #68
|
||||
|
||||
decltype(o_shared1) i_shared1;
|
||||
decltype(o_shared2) i_shared2;
|
||||
decltype(o_unique1) i_unique1;
|
||||
|
||||
Reference in New Issue
Block a user