Files
2025-10-25 03:02:53 +03:00

44 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.11Specialized <memory> algorithms") are declared in the header [<memory>](memory.syn#header:%3cmemory%3e "20.2.2Header <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.8New[expr.new]") ([[expr.new]](expr.new "7.6.2.8New"))
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.11Specialized <memory> algorithms"),
the lifetime ends for any existing objects
(including potentially-overlapping subobjects [[intro.object]](intro.object "6.8.2Object model"))
in storage that is reused [[basic.life]](basic.life "6.8.4Lifetime")[.](#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.11Specialized <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; }