diff --git a/include/rcp.h b/include/rcp.h index bc79cf4..e3bab3b 100644 --- a/include/rcp.h +++ b/include/rcp.h @@ -100,9 +100,9 @@ class root private: mutable std::atomic ref_count{0}; +protected: mutable rcp root_rcp; -protected: root() { root_rcp.init_ptr(this); @@ -124,18 +124,12 @@ public: delete this; } } - - rcp & get_root_rcp() - { - return root_rcp; - } }; #define rcp_managed(classname) \ rcp get_rcp() \ { \ - root * r = (root *)this; \ - return rcp(r->get_root_rcp()); \ + return rcp(root_rcp); \ } \ template \ static rcp create(Args&&... args) \