From Jason Turner

[func.wrap.copy.ctor]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzoogwtsl/{from.md → to.md} +174 -0
tmp/tmpzoogwtsl/{from.md → to.md} RENAMED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### Constructors, assignments, and destructor <a id="func.wrap.copy.ctor">[[func.wrap.copy.ctor]]</a>
2
+
3
+ ``` cpp
4
+ template<class VT>
5
+ static constexpr bool is-callable-from = see below;
6
+ ```
7
+
8
+ If *noex* is `true`, *`is-callable-from`*`<VT>` is equal to:
9
+
10
+ ``` cpp
11
+ is_nothrow_invocable_r_v<R, VT cv ref, ArgTypes...> &&
12
+ is_nothrow_invocable_r_v<R, VT inv-quals, ArgTypes...>
13
+ ```
14
+
15
+ Otherwise, *`is-callable-from`*`<VT>` is equal to:
16
+
17
+ ``` cpp
18
+ is_invocable_r_v<R, VT cv ref, ArgTypes...> &&
19
+ is_invocable_r_v<R, VT inv-quals, ArgTypes...>
20
+ ```
21
+
22
+ ``` cpp
23
+ copyable_function() noexcept;
24
+ copyable_function(nullptr_t) noexcept;
25
+ ```
26
+
27
+ *Ensures:* `*this` has no target object.
28
+
29
+ ``` cpp
30
+ copyable_function(const copyable_function& f);
31
+ ```
32
+
33
+ *Ensures:* `*this` has no target object if `f` had no target object.
34
+ Otherwise, the target object of `*this` is a copy of the target object
35
+ of `f`.
36
+
37
+ *Throws:* Any exception thrown by the initialization of the target
38
+ object. May throw `bad_alloc`.
39
+
40
+ ``` cpp
41
+ copyable_function(copyable_function&& f) noexcept;
42
+ ```
43
+
44
+ *Ensures:* The target object of `*this` is the target object `f` had
45
+ before construction, and `f` is in a valid state with an unspecified
46
+ value.
47
+
48
+ ``` cpp
49
+ template<class F> copyable_function(F&& f);
50
+ ```
51
+
52
+ Let `VT` be `decay_t<F>`.
53
+
54
+ *Constraints:*
55
+
56
+ - `remove_cvref_t<F>` is not the same type as `copyable_function`, and
57
+ - `remove_cvref_t<F>` is not a specialization of `in_place_type_t`, and
58
+ - *`is-callable-from`*`<VT>` is `true`.
59
+
60
+ *Mandates:*
61
+
62
+ - `is_constructible_v<VT, F>` is `true`, and
63
+ - `is_copy_constructible_v<VT>` is `true`.
64
+
65
+ *Preconditions:* `VT` meets the *Cpp17Destructible* and
66
+ *Cpp17CopyConstructible* requirements.
67
+
68
+ *Ensures:* `*this` has no target object if any of the following hold:
69
+
70
+ - `f` is a null function pointer value, or
71
+ - `f` is a null member pointer value, or
72
+ - `remove_cvref_t<F>` is a specialization of the `copyable_function`
73
+ class template, and `f` has no target object.
74
+
75
+ Otherwise, `*this` has a target object of type `VT`
76
+ direct-non-list-initialized with `std::forward<F>(f)`.
77
+
78
+ *Throws:* Any exception thrown by the initialization of the target
79
+ object. May throw `bad_alloc` unless `VT` is a function pointer or a
80
+ specialization of `reference_wrapper`.
81
+
82
+ ``` cpp
83
+ template<class T, class... Args>
84
+ explicit copyable_function(in_place_type_t<T>, Args&&... args);
85
+ ```
86
+
87
+ Let `VT` be `decay_t<T>`.
88
+
89
+ *Constraints:*
90
+
91
+ - `is_constructible_v<VT, Args...>` is `true`, and
92
+ - *`is-callable-from`*`<VT>` is `true`.
93
+
94
+ *Mandates:*
95
+
96
+ - `VT` is the same type as `T`, and
97
+ - `is_copy_constructible_v<VT>` is `true`.
98
+
99
+ *Preconditions:* `VT` meets the *Cpp17Destructible* and
100
+ *Cpp17CopyConstructible* requirements.
101
+
102
+ *Ensures:* `*this` has a target object of type `VT`
103
+ direct-non-list-initialized with `std::forward<Args>(args)...`.
104
+
105
+ *Throws:* Any exception thrown by the initialization of the target
106
+ object. May throw `bad_alloc` unless `VT` is a pointer or a
107
+ specialization of `reference_wrapper`.
108
+
109
+ ``` cpp
110
+ template<class T, class U, class... Args>
111
+ explicit copyable_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
112
+ ```
113
+
114
+ Let `VT` be `decay_t<T>`.
115
+
116
+ *Constraints:*
117
+
118
+ - `is_constructible_v<VT, initializer_list<U>&, Args...>` is `true`, and
119
+ - *`is-callable-from`*`<VT>` is `true`.
120
+
121
+ *Mandates:*
122
+
123
+ - `VT` is the same type as `T`, and
124
+ - `is_copy_constructible_v<VT>` is `true`.
125
+
126
+ *Preconditions:* `VT` meets the *Cpp17Destructible* and
127
+ *Cpp17CopyConstructible* requirements.
128
+
129
+ *Ensures:* `*this` has a target object of type `VT`
130
+ direct-non-list-initialized with `ilist, std::forward<Args>(args)...`.
131
+
132
+ *Throws:* Any exception thrown by the initialization of the target
133
+ object. May throw `bad_alloc` unless `VT` is a pointer or a
134
+ specialization of `reference_wrapper`.
135
+
136
+ ``` cpp
137
+ copyable_function& operator=(const copyable_function& f);
138
+ ```
139
+
140
+ *Effects:* Equivalent to: `copyable_function(f).swap(*this);`
141
+
142
+ *Returns:* `*this`.
143
+
144
+ ``` cpp
145
+ copyable_function& operator=(copyable_function&& f);
146
+ ```
147
+
148
+ *Effects:* Equivalent to: `copyable_function(std::move(f)).swap(*this);`
149
+
150
+ *Returns:* `*this`.
151
+
152
+ ``` cpp
153
+ copyable_function& operator=(nullptr_t) noexcept;
154
+ ```
155
+
156
+ *Effects:* Destroys the target object of `*this`, if any.
157
+
158
+ *Returns:* `*this`.
159
+
160
+ ``` cpp
161
+ template<class F> copyable_function& operator=(F&& f);
162
+ ```
163
+
164
+ *Effects:* Equivalent to:
165
+ `copyable_function(std::forward<F>(f)).swap(*this);`
166
+
167
+ *Returns:* `*this`.
168
+
169
+ ``` cpp
170
+ ~copyable_function();
171
+ ```
172
+
173
+ *Effects:* Destroys the target object of `*this`, if any.
174
+