Wouldn't it be nice to extend shared_ptr to support transaction-like
semantics? Or is it possible already?
Sometimes it's needed to execute code on exit only until we haven't reached
some point (of "no return"):
>Wouldn't it be nice to extend shared_ptr to support transaction-like
>semantics? Or is it possible already?
>Sometimes it's needed to execute code on exit only until we haven't reached
>some point (of "no return"):
This really is an abuse of shared_ptr. Search this list and the
developer list for "scope guard", there was some interesting discussion
a few weeks ago.
Re: [serialization] serialization of shared_ptr withnon-default destructor
The following "blunt instrument" will make things work - though I'm not sure
that its not a little tooo crude. That is it will still prevent your
from getting called via delete - though it could now be called via
Mikko Vainio wrote:
> Dear Sirs,
> Does anyone have a working example of serialization of shared_ptrs
> with non-default deleter and factory construction as described in
> The code below (correctly) triggers error in boost/checked_delete.hpp
> because the destructor of class X is private.
> #include <iostream>
> #include <fstream>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
> #include <boost/serialization/export.hpp>
> #include <boost/serialization/shared_ptr.hpp>
> #include <boost/shared_ptr.hpp>
> class X