[saferecl.hp.base]

# 32 Concurrency support library [[thread]](./#thread)

## 32.11 Safe reclamation [[saferecl]](saferecl#hp.base)

### 32.11.3 Hazard pointers [[saferecl.hp]](saferecl.hp#base)

#### 32.11.3.3 Class template hazard_pointer_obj_base [saferecl.hp.base]

namespace std {template<class T, class D = default_delete<T>>class hazard_pointer_obj_base {public:void retire(D d = D()) noexcept; protected: hazard_pointer_obj_base() = default;
 hazard_pointer_obj_base(const hazard_pointer_obj_base&) = default;
 hazard_pointer_obj_base(hazard_pointer_obj_base&&) = default;
 hazard_pointer_obj_base& operator=(const hazard_pointer_obj_base&) = default;
 hazard_pointer_obj_base& operator=(hazard_pointer_obj_base&&) = default; ~hazard_pointer_obj_base() = default; private: D *deleter*; // *exposition only*};}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13420)

D shall be a function object type ([[func.require]](func.require "22.10.4 Requirements"))
for which, given a value d of type D and
a value ptr of type T*,
the expression d(ptr) is valid[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13426)

The behavior of a program
that adds specializations for hazard_pointer_obj_base is undefined[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13430)

D shall meet the requirements for[*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") and [*Cpp17MoveAssignable*](utility.arg.requirements#:Cpp17MoveAssignable "16.4.4.2 Template argument requirements [utility.arg.requirements]")[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13434)

T may be an incomplete type[.](#4.sentence-1)

It shall be complete before any member
of the resulting specialization of hazard_pointer_obj_base is referenced[.](#4.sentence-2)

[ð](#lib:retire,hazard_pointer_obj_base)

`void retire(D d = D()) noexcept;
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13446)

*Mandates*: T is a hazard-protectable type[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13450)

*Preconditions*: *this is
a base class subobject of an object x of type T[.](#6.sentence-1)

x is not retired[.](#6.sentence-2)

Move-assigning d to deleter does not exit via an exception[.](#6.sentence-3)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L13457)

*Effects*: Move-assigns d to deleter,
thereby setting it as the deleter of x,
then retires x[.](#7.sentence-1)

May reclaim possibly-reclaimable objects[.](#7.sentence-2)
