diff --git a/Test/paulmck/rcu.hpp b/Test/paulmck/rcu.hpp index 60b7412..f07f9d4 100644 --- a/Test/paulmck/rcu.hpp +++ b/Test/paulmck/rcu.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include // Derived-type approach. All RCU-protected data structures using this @@ -10,38 +11,18 @@ // from std::rcu_head. No idea what happens in case of multiple inheritance. namespace std { - template, bool E = is_empty::value> - class rcu_obj_base: private rcu_head { - D deleter; + template> + class rcu_obj_base: private rcu_head, private std::tuple { public: void retire(D d = {}) { - deleter = std::move(d); - ::call_rcu( - static_cast(this), - [](rcu_head *rhp) { - auto rhdp = static_cast(rhp); - auto obj = static_cast(rhdp); - rhdp->deleter(obj); - } - ); - } - }; - - - // Specialization for when D is an empty type. - - template - class rcu_obj_base: private rcu_head { - public: - void retire(D = {}) - { + std::get<0>(*this) = std::move(d); ::call_rcu( static_cast(this), [](rcu_head *rhp) { auto rhdp = static_cast(rhp); auto obj = static_cast(rhdp); - D()(obj); + std::get<0>(*rhdp)(obj); } ); }