This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

101
cppdraft/any/assign.md Normal file
View File

@@ -0,0 +1,101 @@
[any.assign]
# 22 General utilities library [[utilities]](./#utilities)
## 22.7 Storage for any type [[any]](any#assign)
### 22.7.4 Class any [[any.class]](any.class#any.assign)
#### 22.7.4.3 Assignment [any.assign]
[🔗](#lib:operator=,any)
`any& operator=(const any& rhs);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7315)
*Effects*: As if by any(rhs).swap(*this)[.](#1.sentence-1)
No effects if an exception is thrown[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7320)
*Returns*: *this[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7324)
*Throws*: Any exceptions arising from the copy constructor for the contained value[.](#3.sentence-1)
[🔗](#lib:operator=,any_)
`any& operator=(any&& rhs) noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7335)
*Effects*: As if by any(std::move(rhs)).swap(*this)[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7339)
*Postconditions*: The state of *this is equivalent to the original state of rhs[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7343)
*Returns*: *this[.](#6.sentence-1)
[🔗](#lib:operator=,any__)
`template<class T>
any& operator=(T&& rhs);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7355)
Let VT be decay_t<T>[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7358)
*Constraints*: VT is not the same type as any andis_copy_constructible_v<VT> is true[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7363)
*Preconditions*: VT meets the [*Cpp17CopyConstructible*](utility.arg.requirements#:Cpp17CopyConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]") requirements[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7367)
*Effects*: Constructs an object tmp of type any that contains an object of type VT direct-initialized with std::forward<T>(rhs), and tmp.swap(*this)[.](#10.sentence-1)
No effects if an exception is thrown[.](#10.sentence-2)
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7372)
*Returns*: *this[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L7376)
*Throws*: Any exception thrown by the selected constructor of VT[.](#12.sentence-1)