Skip to content

Commit 9e16c5f

Browse files
committed
Apply resolution of LWG 2551 (from Motion 3).
1 parent 141f1e3 commit 9e16c5f

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

memory.html

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,12 @@ <h1><code>shared_ptr</code> constructors</h1>
361361
otherwise, <code>Y*</code> shall be convertible to <code>T*</code>.</cxx-requires>
362362

363363
<cxx-effects>When <code>T</code> is not an array type, constructs a <code>shared_ptr</code> object that <i>owns</i> the pointer <code>p</code>.
364-
Otherwise, constructs a <code>shared_ptr</code> that <em>owns</em> <code>p</code> and a deleter of an unspecified type that calls <code>delete[] p</code>.</cxx-effects>
364+
Otherwise, constructs a <code>shared_ptr</code> that <em>owns</em> <code>p</code> and a deleter of an unspecified type that calls <code>delete[] p</code>.
365+
If an exception is thrown, <code>delete p</code> is called when <code>T</code> is not an array type, <code>delete[] p</code> otherwise.</cxx-effects>
365366

366367
<cxx-postconditions><code>use_count() == 1 &amp;&amp; get() == p</code>.</cxx-postconditions>
367368

368369
<cxx-throws><code>bad_alloc</code>, or an implementation-defined exception when a resource other than memory could not be obtained.</cxx-throws>
369-
370-
<cxx-exception-safety>If an exception is thrown, <code>delete p</code> is called when <code>T</code> is not an array type, <code>delete[] p</code> otherwise.</cxx-exception-safety>
371370
</cxx-function>
372371

373372
<cxx-function>
@@ -381,13 +380,11 @@ <h1><code>shared_ptr</code> constructors</h1>
381380
when <code>T</code> is <code>U[]</code>, <code>Y(*)[]</code> shall be convertible to <code>T*</code>;
382381
otherwise, <code>Y*</code> shall be convertible to <code>T*</code>.</cxx-requires>
383382

384-
<cxx-effects>Constructs a <code>shared_ptr</code> object that <i>owns</i> the object <code>p</code> and the deleter <code>d</code>. The second and fourth constructors shall use a copy of <code>a</code> to allocate memory for internal use.</cxx-effects>
383+
<cxx-effects>Constructs a <code>shared_ptr</code> object that <i>owns</i> the object <code>p</code> and the deleter <code>d</code>. The second and fourth constructors shall use a copy of <code>a</code> to allocate memory for internal use. If an exception is thrown, <code>d(p)</code> is called.</cxx-effects>
385384

386385
<cxx-postconditions><code>use_count() == 1 &amp;&amp; get() == p</code>.</cxx-postconditions>
387386

388387
<cxx-throws><code>bad_alloc</code>, or an implementation-defined exception when a resource other than memory could not be obtained.</cxx-throws>
389-
390-
<cxx-exception-safety>If an exception is thrown, <code>d(p)</code> is called.</cxx-exception-safety>
391388
</cxx-function>
392389

393390
<cxx-function>
@@ -434,23 +431,19 @@ <h1><code>shared_ptr</code> constructors</h1>
434431

435432
<cxx-requires><code>Y*</code> shall be <i>compatible with</i> <code>T*</code>.</cxx-requires>
436433

437-
<cxx-effects>Constructs a <code>shared_ptr</code> object that <i>shares ownership</i> with <code>r</code> and stores a copy of the pointer stored in <code>r</code>.</cxx-effects>
434+
<cxx-effects>Constructs a <code>shared_ptr</code> object that <i>shares ownership</i> with <code>r</code> and stores a copy of the pointer stored in <code>r</code>. If an exception is thrown, the constructor has no effect.</cxx-effects>
438435

439436
<cxx-postconditions><code>use_count() == r.use_count()</code>.</cxx-postconditions>
440437

441438
<cxx-throws><code>bad_weak_ptr</code> when <code>r.expired()</code>.</cxx-throws>
442-
443-
<cxx-exception-safety>If an exception is thrown, the constructor has no effect.</cxx-exception-safety>
444439
</cxx-function>
445440

446441
<cxx-function>
447442
<cxx-signature>template &lt;class Y, class D> shared_ptr(unique_ptr&lt;Y, D>&& r);</cxx-signature>
448443

449444
<cxx-remarks>This constructor shall not participate in overload resolution unless <code>Y*</code> is <em>compatible with</em> <code>T*</code>.</cxx-remarks>
450445

451-
<cxx-effects>Equivalent to <code>shared_ptr(r.release(), r.get_deleter())</code> when <code>D</code> is not a reference type, otherwise <code>shared_ptr(r.release(), ref(r.get_deleter()))</code>.</cxx-effects>
452-
453-
<cxx-exception-safety>If an exception is thrown, the constructor has no effect.</cxx-exception-safety>
446+
<cxx-effects>Equivalent to <code>shared_ptr(r.release(), r.get_deleter())</code> when <code>D</code> is not a reference type, otherwise <code>shared_ptr(r.release(), ref(r.get_deleter()))</code>. If an exception is thrown, the constructor has no effect.</cxx-effects>
454447
</cxx-function>
455448
</cxx-section>
456449

0 commit comments

Comments
 (0)