/** * Resets the internal unit pointer to match the given pointer. * The value of my_manager_ is preserved -- the old unit is deregistered, * and the new unit is registered with the same manager. */ void fake_unit_ptr::reset(const internal_ptr & ptr) { if (unit_.get() != ptr.get()) { fake_unit_manager * mgr = my_manager_; remove_from_fake_unit_manager(); unit_ = ptr; if (mgr) place_on_fake_unit_manager(mgr); } }
explicit operator bool() const { return unit_.get() != nullptr; }