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

62 lines
1.7 KiB
Markdown

[refwrap.helpers]
# 22 General utilities library [[utilities]](./#utilities)
## 22.10 Function objects [[function.objects]](function.objects#refwrap.helpers)
### 22.10.6 Class template reference_wrapper [[refwrap]](refwrap#helpers)
#### 22.10.6.7 Helper functions [refwrap.helpers]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11913)
The template parameter T of
the following ref and cref function templates
may be an incomplete type[.](#1.sentence-1)
[🔗](#lib:ref,reference_wrapper)
`template<class T> constexpr reference_wrapper<T> ref(T& t) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11924)
*Returns*: reference_wrapper<T>(t)[.](#2.sentence-1)
[🔗](#lib:ref,reference_wrapper_)
`template<class T> constexpr reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11935)
*Returns*: t[.](#3.sentence-1)
[🔗](#lib:cref,reference_wrapper)
`template<class T> constexpr reference_wrapper<const T> cref(const T& t) noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11946)
*Returns*: reference_wrapper<const T>(t)[.](#4.sentence-1)
[🔗](#lib:cref,reference_wrapper_)
`template<class T> constexpr reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11957)
*Returns*: t[.](#5.sentence-1)