mirror of
https://github.com/boostorg/optional.git
synced 2025-07-17 22:32:08 +02:00
spelling: uninitialized
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
committed by
Andrzej Krzemienski
parent
246f1663e1
commit
46ad495a60
@ -91,7 +91,7 @@ We could write function `convert` in a slightly different manner, so that it has
|
|||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
The default constructor of `optional` creates an unitialized optional object. Unlike with `int`s you cannot have an `optional<int>` in an indeterminate state. Its state is always well defined. Instruction `ans = i` initializes the optional object. It uses the 'mixed' assignment from `int`. In general, for `optional<T>`, when an assignment from `T` is invoked, it can do two things. If the optional object is not initialized (our case here), it initializes the contained value using `T`'s copy constructor. If the optional object is already initialized, it assigns the new value to it using `T`'s copy assignment.
|
The default constructor of `optional` creates an uninitialized optional object. Unlike with `int`s you cannot have an `optional<int>` in an indeterminate state. Its state is always well defined. Instruction `ans = i` initializes the optional object. It uses the 'mixed' assignment from `int`. In general, for `optional<T>`, when an assignment from `T` is invoked, it can do two things. If the optional object is not initialized (our case here), it initializes the contained value using `T`'s copy constructor. If the optional object is already initialized, it assigns the new value to it using `T`'s copy assignment.
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Optional data members]
|
[section Optional data members]
|
||||||
|
@ -293,8 +293,8 @@
|
|||||||
</p>
|
</p>
|
||||||
<h5>
|
<h5>
|
||||||
<a name="boost_optional.development.the_interface.h0"></a>
|
<a name="boost_optional.development.the_interface.h0"></a>
|
||||||
<span class="phrase"><a name="boost_optional.development.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_untitialized_optional_objects__the_operators___and___gt_"></a></span><a class="link" href="development.html#boost_optional.development.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_untitialized_optional_objects__the_operators___and___gt_">Lexically-hinted
|
<span class="phrase"><a name="boost_optional.development.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_uninitialized_optional_objects__the_operators___and___gt_"></a></span><a class="link" href="development.html#boost_optional.development.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_uninitialized_optional_objects__the_operators___and___gt_">Lexically-hinted
|
||||||
Value Access in the presence of possibly untitialized optional objects: The
|
Value Access in the presence of possibly uninitialized optional objects: The
|
||||||
operators * and -></a>
|
operators * and -></a>
|
||||||
</h5>
|
</h5>
|
||||||
<p>
|
<p>
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
The default constructor of <code class="computeroutput"><span class="identifier">optional</span></code>
|
The default constructor of <code class="computeroutput"><span class="identifier">optional</span></code>
|
||||||
creates an unitialized optional object. Unlike with <code class="computeroutput"><span class="keyword">int</span></code>s
|
creates an uninitialized optional object. Unlike with <code class="computeroutput"><span class="keyword">int</span></code>s
|
||||||
you cannot have an <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span></code>
|
you cannot have an <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span></code>
|
||||||
in an indeterminate state. Its state is always well defined. Instruction
|
in an indeterminate state. Its state is always well defined. Instruction
|
||||||
<code class="computeroutput"><span class="identifier">ans</span> <span class="special">=</span>
|
<code class="computeroutput"><span class="identifier">ans</span> <span class="special">=</span>
|
||||||
|
@ -398,8 +398,8 @@
|
|||||||
</p>
|
</p>
|
||||||
<h6>
|
<h6>
|
||||||
<a name="boost_optional.tutorial.design_overview.the_interface.h0"></a>
|
<a name="boost_optional.tutorial.design_overview.the_interface.h0"></a>
|
||||||
<span class="phrase"><a name="boost_optional.tutorial.design_overview.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_untitialized_optional_objects__the_operators___and___gt_"></a></span><a class="link" href="tutorial.html#boost_optional.tutorial.design_overview.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_untitialized_optional_objects__the_operators___and___gt_">Lexically-hinted
|
<span class="phrase"><a name="boost_optional.tutorial.design_overview.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_uninitialized_optional_objects__the_operators___and___gt_"></a></span><a class="link" href="tutorial.html#boost_optional.tutorial.design_overview.the_interface.lexically_hinted_value_access_in_the_presence_of_possibly_uninitialized_optional_objects__the_operators___and___gt_">Lexically-hinted
|
||||||
Value Access in the presence of possibly untitialized optional objects:
|
Value Access in the presence of possibly uninitialized optional objects:
|
||||||
The operators * and -></a>
|
The operators * and -></a>
|
||||||
</h6>
|
</h6>
|
||||||
<p>
|
<p>
|
||||||
|
@ -727,7 +727,7 @@ void test_relops( T const* )
|
|||||||
BOOST_TEST ( !(def0 != def0) ) ;
|
BOOST_TEST ( !(def0 != def0) ) ;
|
||||||
BOOST_TEST ( !(opt0 != opt0) ) ;
|
BOOST_TEST ( !(opt0 != opt0) ) ;
|
||||||
|
|
||||||
// Check when both are uininitalized.
|
// Check when both are uninitialized.
|
||||||
BOOST_TEST ( def0 == def1 ) ; // both uninitialized compare equal
|
BOOST_TEST ( def0 == def1 ) ; // both uninitialized compare equal
|
||||||
BOOST_TEST ( !(def0 < def1) ) ; // uninitialized is never less than uninitialized
|
BOOST_TEST ( !(def0 < def1) ) ; // uninitialized is never less than uninitialized
|
||||||
BOOST_TEST ( !(def0 > def1) ) ; // uninitialized is never greater than uninitialized
|
BOOST_TEST ( !(def0 > def1) ) ; // uninitialized is never greater than uninitialized
|
||||||
|
Reference in New Issue
Block a user