Compare commits
14 Commits
boost-1.41
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
070958fa84 | |||
e14e0fc3ba | |||
3ebabcb2d8 | |||
63f6e7f45e | |||
43eac5bb12 | |||
74674531c8 | |||
a4572497be | |||
951b49f992 | |||
1afed544db | |||
66c366d18a | |||
472a68c920 | |||
3e33d4a200 | |||
95c864e119 | |||
4669cd828c |
@ -12,8 +12,6 @@
|
||||
|
||||
import quickbook ;
|
||||
|
||||
path-constant images : html ;
|
||||
|
||||
xml optional
|
||||
:
|
||||
optional.qbk
|
||||
@ -28,8 +26,5 @@ boostbook standalone
|
||||
<xsl:param>toc.max.depth=2
|
||||
<xsl:param>toc.section.depth=2
|
||||
<xsl:param>chunk.section.depth=1
|
||||
<format>pdf:<xsl:param>img.src.path=$(images)/
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/optional/doc/html
|
||||
;
|
||||
|
||||
|
||||
|
BIN
doc/html/images/callouts/1.png
Normal file
After Width: | Height: | Size: 391 B |
BIN
doc/html/images/callouts/10.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
doc/html/images/callouts/11.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
doc/html/images/callouts/12.png
Normal file
After Width: | Height: | Size: 488 B |
BIN
doc/html/images/callouts/13.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
doc/html/images/callouts/14.png
Normal file
After Width: | Height: | Size: 499 B |
BIN
doc/html/images/callouts/15.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
doc/html/images/callouts/2.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
doc/html/images/callouts/3.png
Normal file
After Width: | Height: | Size: 431 B |
BIN
doc/html/images/callouts/4.png
Normal file
After Width: | Height: | Size: 441 B |
BIN
doc/html/images/callouts/5.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
doc/html/images/callouts/6.png
Normal file
After Width: | Height: | Size: 431 B |
BIN
doc/html/images/callouts/7.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
doc/html/images/callouts/8.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
doc/html/images/callouts/9.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
doc/html/images/caution.png
Executable file
After Width: | Height: | Size: 4.2 KiB |
BIN
doc/html/images/home.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
doc/html/images/important.png
Executable file
After Width: | Height: | Size: 4.6 KiB |
BIN
doc/html/images/next.png
Executable file
After Width: | Height: | Size: 768 B |
BIN
doc/html/images/note.png
Executable file
After Width: | Height: | Size: 4.5 KiB |
BIN
doc/html/images/prev.png
Executable file
After Width: | Height: | Size: 741 B |
BIN
doc/html/images/tip.png
Executable file
After Width: | Height: | Size: 3.8 KiB |
BIN
doc/html/images/up.png
Executable file
After Width: | Height: | Size: 766 B |
BIN
doc/html/images/warning.png
Executable file
After Width: | Height: | Size: 3.8 KiB |
@ -10,6 +10,8 @@
|
||||
|
||||
|
||||
|
||||
[#optional_implementation_notes]
|
||||
|
||||
[section Implementation Notes]
|
||||
|
||||
`optional<T>` is currently implemented using a custom aligned storage facility
|
||||
|
1676
doc/optional.html
Normal file
@ -331,7 +331,7 @@ factory.
|
||||
* [*Postconditions: ] `*this` is [_initialized] and its value is ['directly given]
|
||||
from the factory `f` (i.e., the value [_is not copied]).
|
||||
* [*Throws:] Whatever the `T` constructor called by the factory throws.
|
||||
* [*Notes:] See [link boost_optional.in_place_factories In-Place Factories]
|
||||
* [*Notes:] See [link optional_in_place_factories In-Place Factories]
|
||||
* [*Exception Safety:] Exceptions can only be thrown during the call to
|
||||
the `T` constructor used by the factory; in that case, this constructor has
|
||||
no effect.
|
||||
@ -385,7 +385,7 @@ __SPACE__
|
||||
* [*Postconditions: ] `*this` is initialized and it references the same
|
||||
object referenced by `rhs`.
|
||||
* [*Notes:] If `*this` was initialized, is is ['rebound] to the new object.
|
||||
See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior.
|
||||
See [link optional_refassign here] for details on this behavior.
|
||||
* [*Example:]
|
||||
``
|
||||
int a = 1 ;
|
||||
@ -444,7 +444,7 @@ __SPACE__
|
||||
references the same object referenced by `*rhs`; otherwise, `*this` is
|
||||
uninitialized (and references no object).
|
||||
* [*Notes:] If `*this` was initialized and so is *rhs, this is is ['rebound] to
|
||||
the new object. See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior.
|
||||
the new object. See [link optional_refassign here] for details on this behavior.
|
||||
* [*Example:]
|
||||
``
|
||||
int a = 1 ;
|
||||
|
@ -23,6 +23,8 @@ rather than the reference itself.
|
||||
|
||||
[endsect]
|
||||
|
||||
[#optional_refassign]
|
||||
|
||||
[section Rebinding semantics for assignment of optional references]
|
||||
|
||||
If you assign to an ['uninitialized ] `optional<T&>` the effect is to bind (for
|
||||
@ -110,6 +112,8 @@ In such scenario, you can assign the value itself directly, as in:
|
||||
|
||||
[endsect]
|
||||
|
||||
[#optional_in_place_factories]
|
||||
|
||||
[section In-Place Factories]
|
||||
|
||||
One of the typical problems with wrappers and containers is that their
|
||||
@ -201,7 +205,7 @@ A wrapper class aware of this can use it as:
|
||||
{
|
||||
// Wrapped object constructed in-place via a TypedInPlaceFactory.
|
||||
// No temporary created.
|
||||
W ( TypedInPlaceFactory2<X,int,std::string>(123,"hello")) ;
|
||||
W ( TypedInPlaceFactory2<X,int,std::string&rt(123,"hello")) ;
|
||||
}
|
||||
|
||||
The factories are divided in two groups:
|
||||
@ -284,7 +288,7 @@ instead, it won't compile).
|
||||
|
||||
[section Exception Safety Guarantees]
|
||||
|
||||
Because of the current implementation (see [link boost_optional.implementation_notes Implementation Notes]), all of the assignment methods:
|
||||
Because of the current implementation (see [link optional_implementation_notes Implementation Notes]), all of the assignment methods:
|
||||
|
||||
* `optional<T>::operator= ( optional<T> const& )`
|
||||
* `optional<T>::operator= ( T const& )`
|
||||
|
1
test/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
bin
|
@ -342,14 +342,14 @@ void test_binding()
|
||||
int i = 0 ;
|
||||
optional<int&> ori1 = i ;
|
||||
BOOST_CHECK( &(*ori1) == &i ) ;
|
||||
|
||||
|
||||
optional<int&> ori2(i) ;
|
||||
BOOST_CHECK( &(*ori2) == &i ) ;
|
||||
|
||||
|
||||
int const ci = 0 ;
|
||||
optional<int const&> orci1 = ci ;
|
||||
BOOST_CHECK( &(*orci1) == &ci ) ;
|
||||
|
||||
|
||||
optional<int const&> orci2(ci) ;
|
||||
BOOST_CHECK( &(*orci2) == &ci ) ;
|
||||
}
|
||||
@ -360,7 +360,7 @@ int test_main( int, char* [] )
|
||||
{
|
||||
test_with_class_type();
|
||||
test_with_builtin_types();
|
||||
test_binding();
|
||||
test_binding();
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
|
23
test/optional_test_ref_fail2.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
#include "boost/optional.hpp"
|
||||
|
||||
//
|
||||
// THIS TEST SHOULD FAIL TO COMPILE
|
||||
//
|
||||
void optional_reference__test_no_ptr_access()
|
||||
{
|
||||
boost::optional<int&> opt ;
|
||||
opt.get_ptr();
|
||||
}
|
||||
|
||||
|