mirror of
https://github.com/boostorg/optional.git
synced 2025-07-16 22:02:07 +02:00
Minor docs fixes (operator=)
This commit is contained in:
@ -600,18 +600,17 @@ __SPACE__
|
||||
|
||||
[: `optional& optional<T` ['(not a ref)]`>::operator= ( optional const& rhs ) ;`]
|
||||
|
||||
* [*Effect:] Assigns another `optional` to an `optional`.
|
||||
* [*Postconditions:] If `rhs` is initialized, `*this` is initialized and
|
||||
its value is a ['copy] of the value of `rhs`; else `*this` is uninitialized.
|
||||
* [*Throws:] Whatever `T::operator( T const&)` or `T::T( T const& )` throws.
|
||||
* [*Notes:] If both `*this` and `rhs` are initially initialized, `T`'s
|
||||
['assignment operator] is used. If `*this` is initially initialized but `rhs` is
|
||||
uninitialized, `T`'s [destructor] is called. If `*this` is initially uninitialized
|
||||
but `rhs` is initialized, `T`'s ['copy constructor] is called.
|
||||
* [*Exception Safety:] In the event of an exception, the initialization state of
|
||||
`*this` is unchanged and its value unspecified as far as optional is concerned
|
||||
(it is up to `T`'s `operator=()`). If `*this` is initially uninitialized and
|
||||
`T`'s ['copy constructor] fails, `*this` is left properly uninitialized.
|
||||
* [*Requires:] `T` is __COPY_CONSTRUCTIBLE__ and `CopyAssignable`.
|
||||
* [*Effects:]
|
||||
* If `!*this && !rhs` no effect, otherwise
|
||||
* if `bool(*this) && !rhs`, destroys the contained value by calling `val->T::~T()`, otherwise
|
||||
* if `!*this && bool(rhs)`, initializes the contained value as if direct-initializing an object of type `T` with `*rhs`, otherwise
|
||||
* (if `bool(*this) && bool(rhs)`) assigns `*rhs` to the contained value.
|
||||
* [*Returns:] `*this`;
|
||||
* [*Postconditions:] `bool(rhs) == bool(*this)`.
|
||||
* [*Exception Safety:] If any exception is thrown, the initialization state of `*this` and `rhs` remains unchanged.
|
||||
If an exception is thrown during the call to `T`'s copy constructor, no effect.
|
||||
If an exception is thrown during the call to `T`'s copy assignment, the state of its contained value is as defined by the exception safety guarantee of `T`'s copy assignment.
|
||||
* [*Example:]
|
||||
``
|
||||
T v;
|
||||
@ -667,9 +666,10 @@ __SPACE__
|
||||
* if `bool(*this) && !rhs`, destroys the contained value by calling `val->T::~T()`, otherwise
|
||||
* if `!*this && bool(rhs)`, initializes the contained value as if direct-initializing an object of type `T` with `std::move(*rhs)`, otherwise
|
||||
* (if `bool(*this) && bool(rhs)`) assigns `std::move(*rhs)` to the contained value.
|
||||
* [*Returns:] `*this`;
|
||||
* [*Postconditions:] `bool(rhs) == bool(*this)`.
|
||||
* [*Remarks:] The expression inside `noexcept` is equivalent to `is_nothrow_move_constructible<T>::value && is_nothrow_move_assignable<T>::value`.
|
||||
* [*Exception Safety:] If any exception is thrown, the initialization state of `*this` and `rhs` remain unchanged. If an exception is
|
||||
* [*Exception Safety:] If any exception is thrown, the initialization state of `*this` and `rhs` remains unchanged. If an exception is
|
||||
thrown during the call to `T`'s move constructor, the state of `*rhs` is determined by the exception safety guarantee
|
||||
of `T`'s move constructor. If an exception is thrown during the call to T's move-assignment, the state of `**this` and `*rhs` is determined by the exception safety guarantee of T's move assignment.
|
||||
* [*Example:]
|
||||
|
@ -804,36 +804,48 @@
|
||||
</p></blockquote></div>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Effect:</strong></span> Assigns another <code class="computeroutput"><span class="identifier">optional</span></code> to an <code class="computeroutput"><span class="identifier">optional</span></code>.
|
||||
<span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
is <a href="../../../../../utility/CopyConstructible.html" target="_top"><code class="computeroutput"><span class="identifier">CopyConstructible</span></code></a> and <code class="computeroutput"><span class="identifier">CopyAssignable</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Postconditions:</strong></span> If <code class="computeroutput"><span class="identifier">rhs</span></code>
|
||||
is initialized, <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
|
||||
is initialized and its value is a <span class="emphasis"><em>copy</em></span> of the value
|
||||
of <code class="computeroutput"><span class="identifier">rhs</span></code>; else <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
|
||||
is uninitialized.
|
||||
<span class="bold"><strong>Effects:</strong></span>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput"><span class="special">!*</span><span class="keyword">this</span>
|
||||
<span class="special">&&</span> <span class="special">!</span><span class="identifier">rhs</span></code> no effect, otherwise
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Throws:</strong></span> Whatever <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span><span class="keyword">operator</span><span class="special">(</span> <span class="identifier">T</span> <span class="keyword">const</span><span class="special">&)</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span><span class="identifier">T</span><span class="special">(</span> <span class="identifier">T</span> <span class="keyword">const</span><span class="special">&</span> <span class="special">)</span></code>
|
||||
throws.
|
||||
if <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="special">!</span><span class="identifier">rhs</span></code>, destroys the contained value
|
||||
by calling <code class="computeroutput"><span class="identifier">val</span><span class="special">-></span><span class="identifier">T</span><span class="special">::~</span><span class="identifier">T</span><span class="special">()</span></code>, otherwise
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Notes:</strong></span> If both <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> and <code class="computeroutput"><span class="identifier">rhs</span></code>
|
||||
are initially initialized, <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
<span class="emphasis"><em>assignment operator</em></span> is used. If <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> is initially initialized but <code class="computeroutput"><span class="identifier">rhs</span></code> is uninitialized, <code class="computeroutput"><span class="identifier">T</span></code>'s [destructor] is called. If <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
|
||||
is initially uninitialized but <code class="computeroutput"><span class="identifier">rhs</span></code>
|
||||
is initialized, <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
<span class="emphasis"><em>copy constructor</em></span> is called.
|
||||
if <code class="computeroutput"><span class="special">!*</span><span class="keyword">this</span>
|
||||
<span class="special">&&</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>, initializes the contained value
|
||||
as if direct-initializing an object of type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
with <code class="computeroutput"><span class="special">*</span><span class="identifier">rhs</span></code>,
|
||||
otherwise
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Exception Safety:</strong></span> In the event of an
|
||||
exception, the initialization state of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> is unchanged and its value unspecified
|
||||
as far as optional is concerned (it is up to <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
<code class="computeroutput"><span class="keyword">operator</span><span class="special">=()</span></code>).
|
||||
If <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
|
||||
is initially uninitialized and <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
<span class="emphasis"><em>copy constructor</em></span> fails, <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> is left properly uninitialized.
|
||||
(if <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span>
|
||||
<span class="special">&&</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>) assigns <code class="computeroutput"><span class="special">*</span><span class="identifier">rhs</span></code> to the contained value.
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>;
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Exception Safety:</strong></span> If any exception is
|
||||
thrown, the initialization state of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> and <code class="computeroutput"><span class="identifier">rhs</span></code>
|
||||
remains unchanged. If an exception is thrown during the call to <code class="computeroutput"><span class="identifier">T</span></code>'s copy constructor, no effect. If
|
||||
an exception is thrown during the call to <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
copy assignment, the state of its contained value is as defined by the
|
||||
exception safety guarantee of <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
copy assignment.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Example:</strong></span>
|
||||
@ -931,6 +943,9 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>;
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</li>
|
||||
@ -941,7 +956,7 @@
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Exception Safety:</strong></span> If any exception is
|
||||
thrown, the initialization state of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> and <code class="computeroutput"><span class="identifier">rhs</span></code>
|
||||
remain unchanged. If an exception is thrown during the call to <code class="computeroutput"><span class="identifier">T</span></code>'s move constructor, the state of
|
||||
remains unchanged. If an exception is thrown during the call to <code class="computeroutput"><span class="identifier">T</span></code>'s move constructor, the state of
|
||||
<code class="computeroutput"><span class="special">*</span><span class="identifier">rhs</span></code>
|
||||
is determined by the exception safety guarantee of <code class="computeroutput"><span class="identifier">T</span></code>'s
|
||||
move constructor. If an exception is thrown during the call to T's move-assignment,
|
||||
|
@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: June 20, 2014 at 16:17:17 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: June 20, 2014 at 20:25:26 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
Reference in New Issue
Block a user