Skip to content

Commit 38cd9b4

Browse files
committed
Apply resolution of LWG 2509 (from motion 4).
1 parent a72f12d commit 38cd9b4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: any.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ <h1><code>any</code> construct/destruct</h1>
130130
any(ValueType&amp;&amp; value);</cxx-signature>
131131

132132
<p>Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.</p>
133-
<cxx-requires><code>T</code> shall satisfy the <code>CopyConstructible</code> requirements.
133+
<cxx-requires><code>T</code> shall satisfy the <code>CopyConstructible</code> requirements, except for the requirements for <code>MoveConstructible</code>.
134134
If <code>is_copy_constructible_v&lt;T&gt;</code> is false, the program is ill-formed.</cxx-requires>
135-
<cxx-effects>Constructs an object of type <code>any</code> that contains an object of type <code>T</code> direct-initialized with <code>std::forward&lt;ValueType&gt;(value)</code>.</cxx-effects>
135+
<cxx-effects>If <code>is_constructible_v&lt;T, ValueType&amp;&amp;&gt;</code> is true, constructs an object of type <code>any</code> that contains an object of type <code>T</code> direct-initialized with <code>std::forward&lt;ValueType&gt;(value)</code>. Otherwise, constructs an object of type <code>any</code> that contains an object of type <code>T</code> direct-initialized with <code>value</code>.</cxx-effects>
136136
<cxx-remarks>This constructor shall not participate in overload resolution if <code>decay_t&lt;ValueType&gt;</code> is the same type as <code>any</code>.</cxx-remarks>
137137
<cxx-throws>Any exception thrown by the selected constructor of <code>T</code>.</cxx-throws>
138138
</cxx-function>
@@ -236,7 +236,8 @@ <h1><a name="Non-member">Non-member</a> functions</h1>
236236
<cxx-requires><code>is_reference_v&lt;ValueType&gt;</code> is true or <code>is_copy_constructible_v&lt;ValueType&gt;</code> is true.
237237
Otherwise the program is ill-formed.</cxx-requires>
238238
<cxx-returns>For the first form, <code>*any_cast&lt;add_const_t&lt;remove_reference_t&lt;ValueType&gt;&gt;&gt;(&amp;operand)</code>.
239-
For the second and third forms, <code>*any_cast&lt;remove_reference_t&lt;ValueType&gt;&gt;(&amp;operand)</code>.</cxx-returns>
239+
For the second form, <code>*any_cast&lt;remove_reference_t&lt;ValueType&gt;&gt;(&amp;operand)</code>.
240+
For the third form, if <code>is_move_constructible_v&lt;ValueType&gt;</code> is <code>true</code> and <code>is_lvalue_reference_v&lt;ValueType&gt;</code> is <code>false</code>, <code>std::move(*any_cast&lt;remove_reference_t&lt;ValueType&gt;&gt;(&amp;operand))</code>, otherwise, <code>*any_cast&lt;remove_reference_t&lt;ValueType&gt;&gt;(&amp;operand)</code>.</cxx-returns>
240241
<cxx-throws><code>bad_any_cast</code> if <code>operand.type() != typeid(remove_reference_t&lt;ValueType&gt;)</code>.</cxx-throws>
241242
<cxx-example>
242243
<pre><code>any x(5); // x holds int

0 commit comments

Comments
 (0)