This makes no sense, as there is any number of shared_ptr that controls the ownership of the value. You will need to change them all, and this is not possible. Do not forget that the control unit is a part of the implementation, so the transition "aha, but changing it in the control unit" will not work.
Delete actions should be controlled by an instance owned by shared_ptr , for example.
class C { ... void (C::action*)() { &C::action1 }; void action1(); void action2(); ~C() { (this->*action)(); } }; void test() { std::shared_ptr<C> a; a->action = &C::action2;
Kuba ober
source share