+/** Definition of hazptr_recounted_obj_base */
+template <typename T, typename D = std::default_delete<T>>
+class hazptr_obj_base_refcounted : public hazptr_obj {
+ public:
+ /* Retire a removed object and pass the responsibility for
+ * reclaiming it to the hazptr library */
+ void retire(hazptr_domain& domain = default_hazptr_domain(), D reclaim = {});
+
+ /* aquire_ref() increments the reference count
+ *
+ * acquire_ref_safe() is the same as acquire_ref() except that in
+ * addition the caller guarantees that the call is made in a
+ * thread-safe context, e.g., the object is not yet shared. This is
+ * just an optimization to save an atomic operation.
+ *
+ * release_ref() decrements the reference count and returns true if
+ * the object is safe to reclaim.
+ */
+ void acquire_ref();
+ void acquire_ref_safe();
+ bool release_ref();
+
+ private:
+ std::atomic<uint32_t> refcount_{0};
+ D deleter_;
+};
+