From c7200c4aed33438583b5e2e4abf59dbd41b658af Mon Sep 17 00:00:00 2001
From: Andrzej Krzemienski
Date: Fri, 20 Jun 2014 22:30:12 +0200
Subject: [PATCH] Minor docs fixes (operator=)
---
doc/20_reference.qbk | 26 ++++----
.../reference/detailed_semantics.html | 61 ++++++++++++-------
doc/html/index.html | 2 +-
3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/doc/20_reference.qbk b/doc/20_reference.qbk
index 513a72c..069789a 100644
--- a/doc/20_reference.qbk
+++ b/doc/20_reference.qbk
@@ -600,18 +600,17 @@ __SPACE__
[: `optional& optional::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::value && is_nothrow_move_assignable::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:]
diff --git a/doc/html/boost_optional/reference/detailed_semantics.html b/doc/html/boost_optional/reference/detailed_semantics.html
index 6dc0456..8f83d55 100644
--- a/doc/html/boost_optional/reference/detailed_semantics.html
+++ b/doc/html/boost_optional/reference/detailed_semantics.html
@@ -804,36 +804,48 @@
-
- Effect: Assigns another
optional
to an optional
.
+ Requires: T
+ is CopyConstructible
and CopyAssignable
.
-
- Postconditions: If
rhs
- is initialized, *this
- is initialized and its value is a copy of the value
- of rhs
; else *this
- is uninitialized.
+ 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.
+
+
-
- Throws: Whatever
T::operator( T const&)
- or T::T( T const& )
- throws.
+ Returns: *this
;
-
- 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.
+ Postconditions: bool(rhs) == bool(*this)
.
-
- 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.
+ 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:
@@ -931,6 +943,9 @@
+
+ Returns: *this
;
+
Postconditions: bool(rhs) == bool(*this)
.
@@ -941,7 +956,7 @@
Exception Safety: If any exception is
thrown, the initialization state of *this
and rhs
- remain unchanged. If an exception is thrown during the call to T
's move constructor, the state of
+ 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,
diff --git a/doc/html/index.html b/doc/html/index.html
index f217eaa..c840a4f 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -133,7 +133,7 @@
-Last revised: June 20, 2014 at 16:17:17 GMT |
+Last revised: June 20, 2014 at 20:25:26 GMT |
|