From 53b2247432a7bc24b0195345d44d6dd2d546cc2d Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 23 Feb 2026 22:35:57 -0500 Subject: [PATCH] Avoid need for rcp_managed() call in rcp root class --- include/rcp.h | 5 +++-- test/tests.cpp | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/rcp.h b/include/rcp.h index 285a6b6..d5314dd 100644 --- a/include/rcp.h +++ b/include/rcp.h @@ -96,7 +96,7 @@ public: } }; -#define rcp_root() \ +#define rcp_root(classname) \ public: \ void rcp_inc() const \ { \ @@ -110,7 +110,8 @@ public: } \ } \ private: \ - mutable std::atomic ref_count{0} + mutable std::atomic ref_count{0}; \ + rcp_managed(classname) #define rcp_managed(classname) \ public: \ diff --git a/test/tests.cpp b/test/tests.cpp index 4d4be44..ded36b2 100644 --- a/test/tests.cpp +++ b/test/tests.cpp @@ -8,8 +8,7 @@ static int myderived_destruct; class MyBase { - rcp_root(); - rcp_managed(MyBase); + rcp_root(MyBase); protected: MyBase(int x, int y)