You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If <code>is_copy_constructible_v<T></code> is false, the program is ill-formed.</cxx-requires>
175
175
<cxx-effects>Constructs an object <code>tmp</code> of type <code>any</code> that contains an object of type <code>T</code> direct-initialized with <code>std::forward<ValueType>(rhs)</code>, and <code>tmp.swap(*this)</code>.
176
176
No effects if an exception is thrown.</cxx-effects>
177
-
<cxx-returns><code>*this</code></cxx-returns>
177
+
<cxx-returns><code>*this</code>.</cxx-returns>
178
178
<cxx-remarks> This operator shall not participate in overload resolution if <code>decay_t<ValueType></code> is the same type as <code>any</code>.</cxx-remarks>
179
179
<cxx-throws>Any exception thrown by the selected constructor of <code>T</code>.</cxx-throws>
<cxx-effects>Constructs a <code>shared_ptr</code> instance that stores <code>p</code> and <i>shares ownership</i> with <code>r</code>.</cxx-effects>
397
397
398
-
<cxx-postconditions><code>get() == p && use_count() == r.use_count()</code></cxx-postconditions>
398
+
<cxx-postconditions><code>get() == p && use_count() == r.use_count()</code>.</cxx-postconditions>
399
399
400
400
<p>
401
401
<cxx-note>To avoid the possibility of a dangling pointer, the user of this constructor must ensure that <code>p</code> remains valid at least until the ownership group of <code>r</code> is destroyed.</cxx-note>
<cxx-note>The seemingly equivalent expression <code>shared_ptr<T>(static_cast<T*>(r.get()))</code> will eventually result in undefined behavior, attempting to delete the same object twice.</cxx-note>
<p><cxx-note>Unlike <code>basic_string::data()</code> and string literals,
354
354
<code>data()</code> may return a pointer to a buffer that is not null-terminated.
355
355
Therefore it is typically a mistake to pass <code>data()</code> to a routine that takes just a <code>const charT*</code> and expects a null-terminated string.</cxx-note></p>
0 commit comments