[specialized.algorithms.general]

# 26 Algorithms library [[algorithms]](./#algorithms)

## 26.11 Specialized <memory> algorithms [[specialized.algorithms]](specialized.algorithms#general)

### 26.11.1 General [specialized.algorithms.general]

[1](#1)

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

The contents specified in [[specialized.algorithms]](specialized.algorithms "26.11 Specialized <memory> algorithms") are declared in the header [<memory>](memory.syn#header:%3cmemory%3e "20.2.2 Header <memory> synopsis [memory.syn]")[.](#1.sentence-1)

[2](#2)

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

Unless otherwise specified,
if an exception is thrown in the following algorithms,
objects constructed by a placement [*new-expression*](expr.new#nt:new-expression "7.6.2.8 New [expr.new]") ([[expr.new]](expr.new "7.6.2.8 New"))
are destroyed in an unspecified order
before allowing the exception to propagate[.](#2.sentence-1)

[3](#3)

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

[*Note [1](#note-1)*:

When new objects are created by
the algorithms specified in [[specialized.algorithms]](specialized.algorithms "26.11 Specialized <memory> algorithms"),
the lifetime ends for any existing objects
(including potentially-overlapping subobjects [[intro.object]](intro.object "6.8.2 Object model"))
in storage that is reused [[basic.life]](basic.life "6.8.4 Lifetime")[.](#3.sentence-1)

â *end note*]

[4](#4)

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

Some algorithms specified in [[specialized.algorithms]](specialized.algorithms "26.11 Specialized <memory> algorithms") make use of the following exposition-only function templates:template<class T>constexpr void* *voidify*(T& obj) noexcept {return addressof(obj); }template<class I>decltype(auto) *deref-move*(I& it) {if constexpr (is_lvalue_reference_v<decltype(*it)>)return std::move(*it); elsereturn *it; }
