From 960631e201ee2e0906081acbab31a2dfec6891f3 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 6 Apr 2011 20:54:18 +0000 Subject: [PATCH 01/18] Add assignment operators taking an InPlaceFactory to the Detailed Semantics section. Fixes #5378. [SVN r71048] --- .../a_note_about_optional_bool_.html | 16 +- doc/html/boost_optional/acknowledgments.html | 126 +- .../dependencies_and_portability.html | 16 +- .../boost_optional/detailed_semantics.html | 1957 +++++++---------- doc/html/boost_optional/development.html | 187 +- doc/html/boost_optional/examples.html | 24 +- .../exception_safety_guarantees.html | 62 +- .../boost_optional/implementation_notes.html | 16 +- .../boost_optional/in_place_factories.html | 30 +- .../boost_optional/optional_references.html | 50 +- ...for_assignment_of_optional_references.html | 18 +- doc/html/boost_optional/synopsis.html | 16 +- .../boost_optional/type_requirements.html | 16 +- doc/html/index.html | 41 +- doc/reference.qbk | 17 + 15 files changed, 1152 insertions(+), 1440 deletions(-) diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index 896994e..7434cf9 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -1,11 +1,11 @@ - + A note about optional<bool> - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+

A note about optional<bool> @@ -70,7 +70,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index bd09f61..935ed0b 100644 --- a/doc/html/boost_optional/acknowledgments.html +++ b/doc/html/boost_optional/acknowledgments.html @@ -1,117 +1,117 @@ - + Acknowledgments - - + + - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHome +PrevUpHome
-
+

- + Pre-formal review

  • - Peter Dimov suggested the name 'optional', and was the first to point out - the need for aligned storage. -
  • + Peter Dimov suggested the name 'optional', and was the first to point out + the need for aligned storage. +
  • - Douglas Gregor developed 'type_with_alignment', and later Eric Friedman coded - 'aligned_storage', which are the core of the optional class implementation. -
  • + Douglas Gregor developed 'type_with_alignment', and later Eric Friedman + coded 'aligned_storage', which are the core of the optional class implementation. +
  • - Andrei Alexandrescu and Brian Parker also worked with aligned storage techniques - and their work influenced the current implementation. -
  • + Andrei Alexandrescu and Brian Parker also worked with aligned storage techniques + and their work influenced the current implementation. +
  • - Gennadiy Rozental made extensive and important comments which shaped the - design. -
  • + Gennadiy Rozental made extensive and important comments which shaped the + design. +
  • - Vesa Karvonen and Douglas Gregor made quite useful comparisons between optional, - variant and any; and made other relevant comments. -
  • + Vesa Karvonen and Douglas Gregor made quite useful comparisons between + optional, variant and any; and made other relevant comments. +
  • - Douglas Gregor and Peter Dimov commented on comparisons and evaluation in - boolean contexts. -
  • + Douglas Gregor and Peter Dimov commented on comparisons and evaluation + in boolean contexts. +
  • - Eric Friedman helped understand the issues involved with aligned storage, - move/copy operations and exception safety. -
  • + Eric Friedman helped understand the issues involved with aligned storage, + move/copy operations and exception safety. +
  • - Many others have participated with useful comments: Aleksey Gurotov, Kevlin - Henney, David Abrahams, and others I can't recall. -
  • + Many others have participated with useful comments: Aleksey Gurotov, Kevlin + Henney, David Abrahams, and others I can't recall. +

- + Post-formal review

  • - William Kempf carefully considered the originally proposed interface and - suggested the new interface which is currently used. He also started and - fueled the discussion about the analogy optional<>/smart pointer and - about relational operators. -
  • + William Kempf carefully considered the originally proposed interface and + suggested the new interface which is currently used. He also started and + fueled the discussion about the analogy optional<>/smart pointer + and about relational operators. +
  • - Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson - focused on the relational semantics of optional (originally undefined); concluding - with the fact that the pointer-like interface doesn't make it a pointer so - it shall have deep relational operators. -
  • + Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson + focused on the relational semantics of optional (originally undefined); + concluding with the fact that the pointer-like interface doesn't make it + a pointer so it shall have deep relational operators. +
  • - Augustus Saunders also explored the different relational semantics between - optional<> and a pointer and developed the OptionalPointee concept - as an aid against potential conflicts on generic code. -
  • + Augustus Saunders also explored the different relational semantics between + optional<> and a pointer and developed the OptionalPointee concept + as an aid against potential conflicts on generic code. +
  • - Joel de Guzman noticed that optional<> can be seen as an API on top - of variant<T,nil_t>. -
  • + Joel de Guzman noticed that optional<> can be seen as an API on top + of variant<T,nil_t>. +
  • - Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>: - the Maybe type constructor (analogy originally pointed out by David Sankel). -
  • + Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>: + the Maybe type constructor (analogy originally pointed out by David Sankel). +
  • - Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, Rob - Stewart, and others. -
  • + Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, + Rob Stewart, and others. +
  • - Joel de Guzman made the case for the support of references and helped with - the proper semantics. -
  • + Joel de Guzman made the case for the support of references and helped with + the proper semantics. +
  • - Mat Marcus shown the virtues of a value-oriented interface, influencing the - current design, and contributed the idea of "none". -
  • + Mat Marcus shown the virtues of a value-oriented interface, influencing + the current design, and contributed the idea of "none". +
-

-PrevUpHome +PrevUpHome
diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index 6f1f9cd..26c78f9 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -1,11 +1,11 @@ - + Dependencies and Portability - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+

Dependencies and Portability @@ -34,7 +34,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index 35c5a9c..e48adcb 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -1,11 +1,11 @@ - + Detailed Semantics - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -33,24 +33,24 @@

  • - If the entry reads: optional<T(not - a ref)>, the description - corresponds only to the case where T - is not of reference type. -
  • + If the entry reads: optional<T(not + a ref)>, the + description corresponds only to the case where T + is not of reference type. +
  • - If the entry reads: optional<T&>, - the description corresponds only to the case where T - is of reference type. -
  • + If the entry reads: optional<T&>, the description corresponds only + to the case where T is + of reference type. +
  • - If the entry reads: optional<T>, - the description is the same for both cases. -
  • + If the entry reads: optional<T>, the description is the same for both + cases. +
-
+
- +
[Note][Note] Note

@@ -64,277 +64,201 @@ space

- + optional class member functions

space

-

-

-
-

-

-

- optional<T>::optional(); -

-

-

-
+

+ optional<T>::optional(); +

  • -Effect: Default-Constructs an optional. -
  • + Effect: Default-Constructs an optional. +
  • -Postconditions:*this is uninitialized. -
  • + Postconditions: *this is uninitialized. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • - Notes: T's default constructor is not - called. -
  • + Notes: T's default constructor is not + called. +
  • -Example:
    optional<T> def ;
    +          Example: 
    +
    optional<T> def ;
     assert ( !def ) ;
     
    -
  • +

space

-

-

-
-

-

-

- optional<T>::optional( none_t ); -

-

-

-
+

+ optional<T>::optional( none_t ); +

  • -Effect: Constructs an optional - uninitialized. -
  • + Effect: Constructs an optional + uninitialized. +
  • -Postconditions:*this is uninitialized. -
  • + Postconditions: *this is uninitialized. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes:T's - default constructor is not called. - The expression boost::none denotes an instance of boost::none_t that can be used as the parameter. -
  • + Notes: T's + default constructor is not called. + The expression boost::none denotes an instance of boost::none_t that can be used as the parameter. +
  • -Example:
    #include <boost/none.hpp>
    +          Example: 
    +
    #include <boost/none.hpp>
     optional<T> n(none) ;
     assert ( !n ) ;
     
    -
  • +

space

-

-

-
-

-

-

- optional<T (not a ref)>::optional( T const& v ) -

-

-

-
+

+ optional<T (not a ref)>::optional( T const& v ) +

  • -Effect: Directly-Constructs an optional. -
  • + Effect: Directly-Constructs an optional. +
  • -Postconditions:*this is initialized - and its value is acopy of v. -
  • + Postconditions: *this is initialized + and its value is acopy of v. +
  • -Throws: Whatever T::T( - T const& ) throws. -
  • + Throws: Whatever T::T( + T const& ) + throws. +
  • -Notes: T::T( - T const& ) is - called. -
  • + Notes: T::T( + T const& ) + is called. +
  • -Exception Safety: Exceptions can only be - thrown during T::T( T - const& - ); in that case, this constructor - has no effect. -
  • + Exception Safety: Exceptions can only + be thrown during T::T( T + const& + ); in that case, this constructor + has no effect. +
  • -Example:
    T v;
    +          Example: 
    +
    T v;
     optional<T> opt(v);
     assert ( *opt == v ) ;
     
    -
  • +

space

-
-

-

-

- optional<T&>::optional( T& ref ) -

-

-

-
+

+ optional<T&>::optional( T& ref ) +

  • -Effect: Directly-Constructs an optional. -
  • + Effect: Directly-Constructs an optional. +
  • -Postconditions:*this is initialized - and its value is an instance of an internal type wrapping the reference - ref. -
  • + Postconditions: *this is initialized + and its value is an instance of an internal type wrapping the reference + ref. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Example:
    T v;
    +          Example: 
    +
    T v;
     T& vref = v ;
     optional<T&> opt(vref);
     assert ( *opt == v ) ;
     ++ v ; // mutate referee
     assert (*opt == v);
     
    -
  • +

space

-

-

-
-

-

-

- optional<T (not a ref)>::optional( bool condition, - T const& v ) ; -

-

-

-
-
-

-

-

- optional<T&> - ::optional( bool condition, - T& - v ) - ; -

-

-

-
+

+ optional<T (not a ref)>::optional( bool condition, T const& v ) ; +

+

+ optional<T&> ::optional( bool condition, T& + v ) ; +

  • - If condition is true, same as: -
-
-

-

-

- optional<T (not a ref)>::optional( T const& v ) -

-

-

-
-
-

-

-

- optional<T&> - ::optional( T& - v ) -

-

-

-
+ If condition is true, same as: + +

+ optional<T (not a ref)>::optional( T const& v ) +

+

+ optional<T&> ::optional( T& + v ) +

  • - otherwise, same as: -
-
-

-

-

- optional<T ['(not a - ref)]>::optional() -

-

-

-
-
-

-

-

- optional<T&> - ::optional() -

-

-

-
+ otherwise, same as: + +

+ optional<T ['(not a + ref)]>::optional() +

+

+ optional<T&> ::optional() +

space

-

-

-
-

-

-

- optional<T (not a ref)>::optional( optional - const& - rhs ); -

-

-

-
+

+ optional<T (not a ref)>::optional( optional const& rhs ); +

  • -Effect: Copy-Constructs an optional. -
  • + Effect: Copy-Constructs 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. -
  • + 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::T( - T const& ) throws. -
  • + Throws: Whatever T::T( + T const& ) + throws. +
  • -Notes: If rhs is initialized, T::T(T const& ) is - called. -
  • + Notes: If rhs is initialized, T::T(T const& ) + is called. +
  • -Exception Safety: Exceptions can only be - thrown during T::T( T - const& - ); in that case, this constructor - has no effect. -
  • + Exception Safety: Exceptions can only + be thrown during T::T( T + const& + ); in that case, this constructor + has no effect. +
  • -Example:
    optional<T> uninit ;
    +          Example: 
    +
    optional<T> uninit ;
     assert (!uninit);
     
     optional<T> uinit2 ( uninit ) ;
    @@ -346,43 +270,38 @@
     optional<T> init2 ( init ) ;
     assert ( init2 == init ) ;
     
    -
  • +

space

-
-

-

-

- optional<T&>::optional( optional const& rhs ); -

-

-

-
+

+ optional<T&>::optional( optional const& rhs ); +

  • -Effect: Copy-Constructs an optional. -
  • + Effect: Copy-Constructs an optional. +
  • -Postconditions: If rhs - is initialized, *this - is initialized and its value is another reference to the same object referenced - by *rhs; - else *this - is uninitialized. -
  • + Postconditions: If rhs + is initialized, *this + is initialized and its value is another reference to the same object referenced + by *rhs; + else *this + is uninitialized. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: If rhs - is initialized, both *this - and *rhs - will reefer to the same object (they alias). -
  • + Notes: If rhs + is initialized, both *this + and *rhs + will reefer to the same object (they alias). +
  • -Example:
    optional<T&> uninit ;
    +          Example: 
    +
    optional<T&> uninit ;
     assert (!uninit);
     
     optional<T&> uinit2 ( uninit ) ;
    @@ -400,115 +319,97 @@
     assert ( *init  == 3 ) ;
     assert ( *init2 == 3 ) ;
     
    -
  • +

space

-

-

-
-

-

-

- template<U> explicit optional<T - (not a ref)>::optional( optional<U> const& rhs ); -

-

-

-
+

+ template<U> explicit optional<T + (not a ref)>::optional( optional<U> const& rhs ); +

  • -Effect: Copy-Constructs an optional. -
  • + Effect: Copy-Constructs an optional. +
  • -Postconditions: If rhs - is initialized, *this - is initialized and its value is a copy of the value - of rhs converted to type T; - else *this - is uninitialized. -
  • + Postconditions: If rhs + is initialized, *this + is initialized and its value is a copy of the value + of rhs converted to type T; + else *this + is uninitialized. +
  • -Throws: Whatever T::T( - U const& ) throws. -
  • + Throws: Whatever T::T( + U const& ) + throws. +
  • -Notes: T::T( - U const& ) is - called if rhs is initialized, - which requires a valid conversion from U - to T. -
  • + Notes: T::T( + U const& ) + is called if rhs is initialized, + which requires a valid conversion from U + to T. +
  • -Exception Safety: Exceptions can only be - thrown during T::T( U - const& - ); in that case, this constructor - has no effect. -
  • + Exception Safety: Exceptions can only + be thrown during T::T( U + const& + ); in that case, this constructor + has no effect. +
  • -Example:
    optional<double> x(123.4);
    +          Example: 
    +
    optional<double> x(123.4);
     assert ( *x == 123.4 ) ;
     
     optional<int> y(x) ;
     assert( *y == 123 ) ;
     
    -
  • +

space

-

-

-
-

-

-

- template<InPlaceFactory> - explicit optional<T - (not a ref)>::optional( InPlaceFactory const& f ); -

-

-

-
-
-

-

-

- template<TypedInPlaceFactory> - explicit optional<T - (not a ref)>::optional( TypedInPlaceFactory const& f ); -

-

-

-
+

+ template<InPlaceFactory> + explicit optional<T + (not a ref)>::optional( InPlaceFactory const& f ); +

+

+ template<TypedInPlaceFactory> + explicit optional<T + (not a ref)>::optional( TypedInPlaceFactory const& f ); +

  • -Effect: Constructs an optional - with a value of T obtained - from the factory. -
  • + Effect: Constructs an optional + with a value of T obtained + from the factory. +
  • -Postconditions: *this is initialized - and its value is directly given from the factory f (i.e., the value is - not copied). -
  • + 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. -
  • + Throws: Whatever the T + constructor called by the factory throws. +
  • -Notes: See In-Place - Factories -
  • + Notes: See 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. -
  • + 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. +
  • -Example:
    class C { C ( char, double, std::string ) ; } ;
    +          Example: 
    +
    class C { C ( char, double, std::string ) ; } ;
     
     C v('A',123.4,"hello");
     
    @@ -518,55 +419,45 @@
     assert ( *x == v ) ;
     assert ( *y == v ) ;
     
    -
  • +

space

-

-

-
-

-

-

- optional& - optional<T (not a ref)>::operator= ( T - const& - rhs ) - ; -

-

-

-
+

+ optional& + optional<T (not a ref)>::operator= ( T + const& + rhs ) + ; +

  • -Effect: Assigns the value rhs to an optional. -
  • + Effect: Assigns the value rhs to an optional. +
  • -Postconditions: *this is initialized and its value is a copy - of rhs. -
  • + Postconditions: *this is initialized and its value is a + copy of rhs. +
  • -Throws: Whatever T::operator=( T const& ) or - T::T(T - const&) - throws. -
  • + Throws: Whatever T::operator=( T const& ) or T::T(T const&) throws. +
  • -Notes: If *this was initialized, T's - assignment operator is used, otherwise, its copy-constructor is used. -
  • + Notes: If *this was initialized, T's + assignment operator is used, otherwise, its copy-constructor is used. +
  • -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: 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. +
  • -Example:
    T x;
    +          Example: 
    +
    T x;
     optional<T> def ;
     optional<T> opt(x) ;
     
    @@ -576,39 +467,34 @@
     opt = y ;
     assert ( *opt == y ) ;
     
    -
  • +

space

-
-

-

-

- optional<T&>& - optional<T&>::operator= ( T& - const& - rhs ) - ; -

-

-

-
+

+ optional<T&>& + optional<T&>::operator= ( T& + const& + rhs ) + ; +

  • -Effect: (Re)binds thee wrapped reference. -
  • + Effect: (Re)binds thee wrapped reference. +
  • -Postconditions: *this is initialized and it references the - same object referenced by rhs. -
  • + 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 here - for details on this behavior. -
  • + Notes: If *this was initialized, is is rebound + to the new object. See here + for details on this behavior. +
  • -Example:
    int a = 1 ;
    +          Example: 
    +
    int a = 1 ;
     int b = 2 ;
     T& ra = a ;
     T& rb = b ;
    @@ -625,59 +511,54 @@
     c = 4 ;
     assert ( *opt == 4 ) ;
     
    -
  • +

space

-

-

-
-

-

-

- optional& - optional<T (not a ref)>::operator= ( optional - const& - rhs ) - ; -

-

-

-
+

+ optional& + optional<T (not a ref)>::operator= ( optional + const& + rhs ) + ; +

  • -Effect: Assigns another optional - to an optional. -
  • + 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. -
  • + 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. -
  • + 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. -
  • + 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. -
  • + 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. +
  • -Example:
    T v;
    +          Example: 
    +
    T v;
     optional<T> opt(v);
     optional<T> def ;
     
    @@ -685,36 +566,34 @@
     assert ( !def ) ;
     // previous value (copy of 'v') destroyed from within 'opt'.
     
    -
  • +

space

-
-

-

-

- optional<T&> - & optional<T&>::operator= ( optional<T&> const& rhs ) ; -

-

-

-
+

+ optional<T&> & optional<T&>::operator= ( optional<T&> + const& + rhs ) + ; +

  • -Effect: (Re)binds thee wrapped reference. -
  • + Effect: (Re)binds thee wrapped reference. +
  • -Postconditions: If *rhs is initialized, *this is initialized and it references the - same object referenced by *rhs; otherwise, *this is uninitialized (and references no object). -
  • + Postconditions: If *rhs is initialized, *this is initialized and it 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 here - for details on this behavior. -
  • + Notes: If *this was initialized and so is *rhs, this + is is rebound to the new object. See here + for details on this behavior. +
  • -Example:
    int a = 1 ;
    +          Example: 
    +
    int a = 1 ;
     int b = 2 ;
     T& ra = a ;
     T& rb = b ;
    @@ -733,191 +612,179 @@
     c = 4 ;
     assert ( *ora == 4 ) ;
     
    -
  • +

space

-

-

-
-

-

-

- template<U> optional& - optional<T (not a ref)>::operator= ( optional<U> const& rhs ) ; -

-

-

-
+

+ template<U> optional& + optional<T (not a ref)>::operator= ( optional<U> + const& + rhs ) + ; +

  • -Effect: Assigns another convertible optional - to an optional. -
  • + Effect: Assigns another convertible optional + to an optional. +
  • -Postconditions: If rhs - is initialized, *this - is initialized and its value is a copy of the value - of rhsconverted - to type T; else *this is uninitialized. -
  • + Postconditions: If rhs + is initialized, *this + is initialized and its value is a copy of the value + of rhs converted + to type T; else *this is + uninitialized. +
  • -Throws: Whatever T::operator=( U const& ) or - T::T( U - const& - ) throws. -
  • + Throws: Whatever T::operator=( U const& ) or T::T( + U const& ) + throws. +
  • -Notes: If both *this and rhs are initially initialized, T's assignment operator - (from U) 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 - converting constructor (from U) - is called. -
  • + Notes: If both *this and rhs are initially initialized, + T's assignment + operator (from U) + 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 converting + constructor (from U) + 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 - converting constructor fails, *this is left properly uninitialized. -
  • + 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 + converting constructor fails, *this is left properly uninitialized. +
  • -Example:
    T v;
    +          Example: 
    +
    T v;
     optional<T> opt0(v);
     optional<U> opt1;
     
     opt1 = opt0 ;
     assert ( *opt1 == static_cast<U>(v) ) ;
     
    -
  • +

space

-

-

-
-

-

-

- void optional<T - (not a ref)>::reset( T const& v ) ; -

-

-

-
-
  • -Deprecated: same as operator= ( T +

    + template<InPlaceFactory> + optional<T>& optional<T (not a ref)>::operator=( InPlaceFactory const& - v) ; -

-

- space -

-

-

-
-

-

-

- void optional<T>::reset() ; -

-

-

-
-
  • -Deprecated: Same as operator=( detail::none_t ); -
-

- space -

-

-

-
-

-

-

- T const& optional<T - (not a ref)>::operator*() const ; -

-

-

-
-
-

-

-

- T& - optional<T (not a ref)>::operator*(); -

-

-

-
-
-

-

-

- T const& optional<T - (not a ref)>::get() const ; -

-

-

-
-
-

-

-

- T& - optional<T (not a ref)>::get() ; -

-

-

-
-
-

-

-

- inline T - const& - get ( - optional<T (not a ref)> const& ) ; -

-

-

-
-
-

-

-

- inline T& get ( optional<T - (not a ref)> - &) ; -

-

-

-
+ f );
+

+

+ template<TypedInPlaceFactory> + optional<T>& optional<T (not a ref)>::operator=( TypedInPlaceFactory + const& + f ); +

  • -Requirements:*this is initialized -
  • + Effect: Assigns an optional + with a value of T obtained + from the factory. +
  • -Returns: A reference to the contained value -
  • + Postconditions: *this is initialized + and its value is directly given from the factory + f (i.e., the value is not copied). +
  • -Throws: Nothing. -
  • + Throws: Whatever the T + constructor called by the factory throws. +
  • -Notes: The requirement is asserted via - BOOST_ASSERT(). -
  • + Notes: See In-Place + Factories +
  • -Example:
    T v ;
    +          Exception Safety: Exceptions can only
    +          be thrown during the call to the T
    +          constructor used by the factory; in that case, the optional
    +          object will be left empty.
    +        
  • +
+

+ space +

+

+ void optional<T + (not a ref)>::reset( T const& v ) ; +

+
  • + Deprecated: same as operator= ( T + const& + v) + ; +
+

+ space +

+

+ void optional<T>::reset() ; +

+
  • + Deprecated: Same as operator=( detail::none_t ); +
+

+ space +

+

+ T const& optional<T + (not a ref)>::operator*() const ; +

+

+ T& + optional<T (not a ref)>::operator*(); +

+

+ T const& optional<T + (not a ref)>::get() const ; +

+

+ T& + optional<T (not a ref)>::get() ; +

+

+ inline T + const& + get ( + optional<T (not a ref)> const& ) ; +

+

+ inline T& get ( optional<T + (not a ref)> + &) ; +

+
    +
  • + Requirements: *this is initialized +
  • +
  • + Returns: A reference to the contained + value +
  • +
  • + Throws: Nothing. +
  • +
  • + Notes: The requirement is asserted via + BOOST_ASSERT(). +
  • +
  • + Example: +
    T v ;
     optional<T> opt ( v );
     T const& u = *opt;
     assert ( u == v ) ;
    @@ -925,73 +792,45 @@
     *opt = w ;
     assert ( *opt == w ) ;
     
    -
  • +

space

-

-

-
-

-

-

- T const& optional<T - (not a ref)>::get_value_or( - T const& default) const ; -

-

-

-
-
-

-

-

- T& - optional<T (not a ref)>::get_value_or( T& - default ) - ; -

-

-

-
-
-

-

-

- inline T - const& - get_optional_value_or ( - optional<T (not a ref)> const& o, T const& default ) ; -

-

-

-
-
-

-

-

- inline T& get_optional_value_or - ( optional<T - (not a ref)>& - o, - T& - default ) - ; -

-

-

-
+

+ T const& optional<T + (not a ref)>::get_value_or( + T const& default) const ; +

+

+ T& + optional<T (not a ref)>::get_value_or( T& + default ) + ; +

+

+ inline T + const& + get_optional_value_or ( + optional<T (not a ref)> const& o, T const& default ) ; +

+

+ inline T& get_optional_value_or + ( optional<T + (not a ref)>& + o, T& default ) ; +

  • -Returns: A reference to the contained value, - if any, or default. -
  • + Returns: A reference to the contained + value, if any, or default. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Example:
    T v, z ;
    +          Example: 
    +
    T v, z ;
     optional<T> def;
     T const& y = def.get_value_or(z);
     assert ( y == z ) ;
    @@ -1001,90 +840,53 @@
     assert ( u == v ) ;
     assert ( u != z ) ;
     
    -
  • +

space

-
-

-

-

- T const& optional<T&>::operator*() const ; -

-

-

-
-
-

-

-

- T & - optional<T&>::operator*(); -

-

-

-
-
-

-

-

- T const& optional<T&>::get() const ; -

-

-

-
-
-

-

-

- T& - optional<T&>::get() ; -

-

-

-
-
-

-

-

- inline T - const& - get ( - optional<T&> - const& - ) ; -

-

-

-
-
-

-

-

- inline T& get ( optional<T&> &) - ; -

-

-

-
+

+ T const& optional<T&>::operator*() const ; +

+

+ T & + optional<T&>::operator*(); +

+

+ T const& optional<T&>::get() const ; +

+

+ T& + optional<T&>::get() ; +

+

+ inline T + const& + get ( + optional<T&> const& ) ; +

+

+ inline T& get ( optional<T&> + &) ; +

  • -Requirements: *this is initialized -
  • + Requirements: *this is initialized +
  • -Returns:The - reference contained. -
  • + Returns: The + reference contained. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: The requirement is asserted via - BOOST_ASSERT(). -
  • + Notes: The requirement is asserted via + BOOST_ASSERT(). +
  • -Example:
    T v ;
    +          Example: 
    +
    T v ;
     T& vref = v ;
     optional<T&> opt ( vref );
     T const& vref2 = *opt;
    @@ -1092,72 +894,46 @@
     ++ v ;
     assert ( *opt == v ) ;
     
    -
  • +

space

-

-

-
-

-

-

- T const* optional<T - (not a ref)>::get_ptr() const ; -

-

-

-
-
-

-

-

- T* - optional<T (not a ref)>::get_ptr() ; -

-

-

-
-
-

-

-

- inline T - const* - get_pointer ( - optional<T (not a ref)> const& ) ; -

-

-

-
-
-

-

-

- inline T* get_pointer - ( optional<T - (not a ref)> - &) ; -

-

-

-
+

+ T const* optional<T + (not a ref)>::get_ptr() const ; +

+

+ T* + optional<T (not a ref)>::get_ptr() ; +

+

+ inline T + const* get_pointer ( + optional<T (not a ref)> const& ) ; +

+

+ inline T* get_pointer + ( optional<T + (not a ref)> + &) ; +

  • -Returns: If *this is initialized, a pointer to the contained - value; else 0 (null). -
  • + Returns: If *this is initialized, a pointer to the contained + value; else 0 (null). +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: The contained value is permanently - stored within *this, - so you should not hold nor delete this pointer -
  • + Notes: The contained value is permanently + stored within *this, + so you should not hold nor delete this pointer +
  • -Example:
    T v;
    +          Example: 
    +
    T v;
     optional<T> opt(v);
     optional<T> const copt(v);
     T* p = opt.get_ptr() ;
    @@ -1165,213 +941,163 @@
     assert ( p == get_pointer(opt) );
     assert ( cp == get_pointer(copt) ) ;
     
    -
  • +

space

-

-

-
-

-

-

- T const* optional<T - (not a ref)>::operator ->() - const ; -

-

-

-
-
-

-

-

- T* - optional<T (not a ref)>::operator - ->() ; -

-

-

-
+

+ T const* optional<T + (not a ref)>::operator ->() + const ; +

+

+ T* + optional<T (not a ref)>::operator ->() ; +

  • -Requirements: *this is initialized. -
  • + Requirements: *this is initialized. +
  • -Returns: A pointer to the contained value. -
  • + Returns: A pointer to the contained value. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: The requirement is asserted via - BOOST_ASSERT(). -
  • + Notes: The requirement is asserted via + BOOST_ASSERT(). +
  • -Example:
    struct X { int mdata ; } ;
    +          Example: 
    +
    struct X { int mdata ; } ;
     X x ;
     optional<X> opt (x);
     opt->mdata = 2 ;
     
    -
  • +

space

-

-

-
-

-

-

- optional<T>::operator unspecified-bool-type() const ; -

-

-

-
+

+ optional<T>::operator unspecified-bool-type() const ; +

  • -Returns: An unspecified value which if used - on a boolean context is equivalent to (get() != 0) -
  • + Returns: An unspecified value which if + used on a boolean context is equivalent to (get() != 0) +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Example:
    optional<T> def ;
    +          Example: 
    +
    optional<T> def ;
     assert ( def == 0 );
     optional<T> opt ( v ) ;
     assert ( opt );
     assert ( opt != 0 );
     
    -
  • +

space

-

-

-
-

-

-

- bool optional<T>::operator!() ; -

-

-

-
+

+ bool optional<T>::operator!() ; +

  • -Returns: If *this is uninitialized, true; - else false. -
  • + Returns: If *this is uninitialized, true; + else false. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: This operator is provided for those - compilers which can't use the unspecified-bool-type operator - in certain boolean contexts. -
  • + Notes: This operator is provided for those + compilers which can't use the unspecified-bool-type operator + in certain boolean contexts. +
  • -Example:
    optional<T> opt ;
    +          Example: 
    +
    optional<T> opt ;
     assert ( !opt );
     *opt = some_T ;
     
     // Notice the "double-bang" idiom here.
     assert ( !!opt ) ;
     
    -
  • +

space

-

-

-
-

-

-

- bool optional<T>::is_initialized() const ; -

-

-

-
+

+ bool optional<T>::is_initialized() + const ; +

  • -Returns: true - if the optional is initialized, - false otherwise. -
  • + Returns: true + if the optional is initialized, + false otherwise. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Example:
    optional<T> def ;
    +          Example: 
    +
    optional<T> def ;
     assert ( !def.is_initialized() );
     optional<T> opt ( v ) ;
     assert ( opt.is_initialized() );
     
    -
  • +

space

- + Free functions

space

-

-

-
-

-

-

- optional<T (not a ref)> make_optional( T const& v ) -

-

-

-
+

+ optional<T (not a ref)> make_optional( T const& v ) +

  • -Returns: optional<T>(v) for - the deduced type T - of v. -
  • + Returns: optional<T>(v) for the deduced type + T of v. +
  • -Example:
    template<class T> void foo ( optional<T> const& opt ) ;
    +          Example: 
    +
    template<class T> void foo ( optional<T> const& opt ) ;
     
     foo ( make_optional(1+1) ) ; // Creates an optional<int>
     
    -
  • +

space

-

-

-
-

-

-

- optional<T (not a ref)> make_optional( bool condition, - T const& v ) -

-

-

-
+

+ optional<T (not a ref)> make_optional( bool condition, T const& v ) +

  • -Returns: optional<T>(condition,v) for - the deduced type T - of v. -
  • + Returns: optional<T>(condition,v) + for the deduced type T + of v. +
  • -Example:
    optional<double> calculate_foo()
    +          Example: 
    +
    optional<double> calculate_foo()
     {
       double val = compute_foo();
       return make_optional(is_not_nan_and_finite(val),val);
    @@ -1381,44 +1107,40 @@
     if ( !v )
       error("foo wasn't computed");
     
    -
  • +

space

-

-

-
-

-

-

- bool operator - == ( optional<T> const& x, optional<T> const& y ); -

-

-

-
+

+ bool operator + == ( optional<T> const& x, optional<T> + const& + y ); +

  • -Returns: If both x - and y are initialized, (*x == - *y). If only x - or y is initialized, false. If both are uninitialized, true. -
  • + Returns: If both x + and y are initialized, + (*x + == *y). If + only x or y is initialized, false. + If both are uninitialized, true. +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: Pointers have shallow relational - operators while optional - has deep relational operators. Do not use operator - == directly in generic code which - expect to be given either an optional<T> - or a pointer; use equal_pointees() - instead -
  • + Notes: Pointers have shallow relational + operators while optional + has deep relational operators. Do not use operator + == directly in generic code which + expect to be given either an optional<T> or a pointer; use equal_pointees() + instead +
  • -Example:
    T x(12);
    +          Example: 
    +
    T x(12);
     T y(12);
     T z(21);
     optional<T> def0 ;
    @@ -1441,45 +1163,41 @@
     assert ( optX == optY ) ;
     assert ( optX != optZ ) ;
     
    -
  • +

space

-

-

-
-

-

-

- bool operator - < ( - optional<T> const& x, optional<T> const& y ); -

-

-

-
+

+ bool operator + < ( optional<T> const& x, optional<T> + const& + y ); +

  • -Returns: If y - is not initialized, false. If - y is initialized and x is not initialized, true. - If both x and y are initialized, (*x < *y). -
  • + Returns: If y + is not initialized, false. + If y is initialized and + x is not initialized, + true. If both x and y + are initialized, (*x + < *y). +
  • -Throws: Nothing. -
  • + Throws: Nothing. +
  • -Notes: Pointers have shallow relational - operators while optional - has deep relational operators. Do not use operator - < directly in generic code which - expect to be given either an optional<T> - or a pointer; use less_pointees() - instead. -
  • + Notes: Pointers have shallow relational + operators while optional + has deep relational operators. Do not use operator + < directly in generic code which + expect to be given either an optional<T> or a pointer; use less_pointees() + instead. +
  • -Example:
    T x(12);
    +          Example: 
    +
    T x(12);
     T y(34);
     optional<T> def ;
     optional<T> optX(x);
    @@ -1499,157 +1217,124 @@
     assert ( optX == optY ) ;
     assert ( optX != optZ ) ;
     
    -
  • +

space

-

-

-
-

-

-

- bool operator - != ( optional<T> const& x, optional<T> const& y ); -

-

-

-
-
    -
  • -Returns: !( - x == - y ); -
  • -
  • -Throws: Nothing. -
  • -
-

- space -

-

-

-
-

-

-

- bool operator - > ( - optional<T> const& x, optional<T> const& y ); -

-

-

-
-
    -
  • -Returns: ( - y < - x ); -
  • -
  • -Throws: Nothing. -
  • -
-

- space -

-

-

-
-

-

-

- bool operator - <= ( - optional<T> const& x, optional<T> const& y ); -

-

-

-
-
    -
  • -Returns: !( - y<x ); -
  • -
  • -Throws: Nothing. -
  • -
-

- space -

-

-

-
-

-

-

- bool operator - >= ( - optional<T> const& x, optional<T> const& y ); -

-

-

-
-
    -
  • -Returns: !( - x<y ); -
  • -
  • -Throws: Nothing. -
  • -
-

- space -

-

-

-
-

-

-

- void swap - ( optional<T>& x, optional<T>& y - ); -

-

-

-
-
    -
  • -Effect: If both x - and y are initialized, calls - swap(*x,*y) using std::swap. - If only one is initialized, say x, - calls: y.reset(*x); x.reset(); If none is initialized, does nothing. -
  • -
  • -Postconditions: The states of x and y - interchanged. -
  • -
  • -Throws: If both are initialized, whatever - swap(T&,T&) - throws. If only one is initialized, whatever T::T ( - T const& ) throws. -
  • -
  • -Notes: If both are initialized, swap(T&,T&) is used unqualified but with std::swap - introduced in scope. If only one is initialized, T::~T() - and T::T( T +

    + bool operator + != ( optional<T> const& x, optional<T> const& - ) is called. -

  • + y ); +

+
  • -Exception Safety: If both are initialized, - this operation has the exception safety guarantees of swap(T&,T&). - If only one is initialized, it has the same basic guarantee as optional<T>::reset( T const& ). -
  • + Returns: !( + x == + y ); +
  • -Example:
    T x(12);
    +          Throws: Nothing.
    +        
  • +
+

+ space +

+

+ bool operator + > ( optional<T> const& x, optional<T> + const& + y ); +

+
    +
  • + Returns: ( + y < + x ); +
  • +
  • + Throws: Nothing. +
  • +
+

+ space +

+

+ bool operator + <= ( + optional<T> const& x, optional<T> + const& + y ); +

+
    +
  • + Returns: !( + y<x ); +
  • +
  • + Throws: Nothing. +
  • +
+

+ space +

+

+ bool operator + >= ( + optional<T> const& x, optional<T> + const& + y ); +

+
    +
  • + Returns: !( + x<y ); +
  • +
  • + Throws: Nothing. +
  • +
+

+ space +

+

+ void swap + ( optional<T>& + x, optional<T>& y ); +

+
    +
  • + Effect: If both x + and y are initialized, + calls swap(*x,*y) using std::swap. + If only one is initialized, say x, + calls: y.reset(*x); x.reset(); If none is initialized, does nothing. +
  • +
  • + Postconditions: The states of x and y + interchanged. +
  • +
  • + Throws: If both are initialized, whatever + swap(T&,T&) + throws. If only one is initialized, whatever T::T ( T const& ) throws. +
  • +
  • + Notes: If both are initialized, swap(T&,T&) + is used unqualified but with std::swap + introduced in scope. If only one is initialized, T::~T() and T::T( + T const& ) + is called. +
  • +
  • + Exception Safety: If both are initialized, + this operation has the exception safety guarantees of swap(T&,T&). + If only one is initialized, it has the same basic guarantee as optional<T>::reset( T const& ). +
  • +
  • + Example: +
    T x(12);
     T y(21);
     optional<T> def0 ;
     optional<T> def1 ;
    @@ -1668,12 +1353,12 @@
     assert ( *optX == y );
     assert ( *optY == x );
     
    -
  • +
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html index 7c96256..159fd33 100644 --- a/doc/html/boost_optional/development.html +++ b/doc/html/boost_optional/development.html @@ -1,28 +1,28 @@ - + Development - - - + + + - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+ -
+
@@ -112,63 +112,63 @@

  • -deep-copy semantics: copies of the variant - implies copies of the value. -
  • + deep-copy semantics: copies of the variant + implies copies of the value. +
  • -deep-relational semantics: comparisons - between variants matches both current types and values -
  • + deep-relational semantics: comparisons + between variants matches both current types and values +
  • - If the variant's current type is T, - it is modeling an initialized optional. -
  • + If the variant's current type is T, + it is modeling an initialized optional. +
  • - If the variant's current type is not T, - it is modeling an uninitialized optional. -
  • + If the variant's current type is not T, + it is modeling an uninitialized optional. +
  • - Testing if the variant's current type is T - models testing if the optional is initialized -
  • + Testing if the variant's current type is T + models testing if the optional is initialized +
  • - Trying to extract a T from - a variant when its current type is not T, - models the undefined behavior of trying to access the value of an uninitialized - optional -
  • + Trying to extract a T + from a variant when its current type is not T, + models the undefined behavior of trying to access the value of an uninitialized + optional +

Single-element container:

  • -deep-copy semantics: copies of the container - implies copies of the value. -
  • + deep-copy semantics: copies of the container + implies copies of the value. +
  • -deep-relational semantics: comparisons - between containers compare container size and if match, contained value -
  • + deep-relational semantics: comparisons + between containers compare container size and if match, contained value +
  • - If the container is not empty (contains an object of type T), it is modeling an initialized - optional. -
  • + If the container is not empty (contains an object of type T), it is modeling an initialized + optional. +
  • - If the container is empty, it is modeling an uninitialized - optional. -
  • + If the container is empty, it is modeling an uninitialized + optional. +
  • - Testing if the container is empty models testing if the optional is initialized -
  • + Testing if the container is empty models testing if the optional is initialized +
  • - Trying to extract a T from - an empty container models the undefined behavior of trying to access the - value of an uninitialized optional -
  • + Trying to extract a T + from an empty container models the undefined behavior of trying to access + the value of an uninitialized optional +
-
+
@@ -195,56 +195,57 @@

  • -Default Construction: To introduce a formally - uninitialized wrapped object. -
  • + Default Construction: To introduce a + formally uninitialized wrapped object. +
  • -Direct Value Construction via copy: To - introduce a formally initialized wrapped object whose value is obtained - as a copy of some object. -
  • + Direct Value Construction via copy: + To introduce a formally initialized wrapped object whose value is obtained + as a copy of some object. +
  • -Deep Copy Construction: To obtain a new - yet equivalent wrapped object. -
  • + Deep Copy Construction: To obtain a + new yet equivalent wrapped object. +
  • -Direct Value Assignment (upon initialized): - To assign a value to the wrapped object. -
  • + Direct Value Assignment (upon initialized): + To assign a value to the wrapped object. +
  • -Direct Value Assignment (upon uninitialized): - To initialize the wrapped object with a value obtained as a copy of some - object. -
  • + Direct Value Assignment (upon uninitialized): + To initialize the wrapped object with a value obtained as a copy of some + object. +
  • -Assignment (upon initialized): To assign - to the wrapped object the value of another wrapped object. -
  • + Assignment (upon initialized): To assign + to the wrapped object the value of another wrapped object. +
  • -Assignment (upon uninitialized): To initialize - the wrapped object with value of another wrapped object. -
  • + Assignment (upon uninitialized): To + initialize the wrapped object with value of another wrapped object. +
  • -Deep Relational Operations (when supported by the - type T): To compare wrapped object values taking into account - the presence of uninitialized states. -
  • + Deep Relational Operations (when supported by the + type T): To compare wrapped object values taking into account + the presence of uninitialized states. +
  • -Value access: To unwrap the wrapped object. -
  • + Value access: To unwrap the wrapped + object. +
  • -Initialization state query: To determine - if the object is formally initialized or not. -
  • + Initialization state query: To determine + if the object is formally initialized or not. +
  • -Swap: To exchange wrapped objects. (with - whatever exception safety guarantees are provided by T's - swap). -
  • + Swap: To exchange wrapped objects. (with + whatever exception safety guarantees are provided by T's + swap). +
  • -De-initialization: To release the wrapped - object (if any) and leave the wrapper in the uninitialized state. -
  • + De-initialization: To release the wrapped + object (if any) and leave the wrapper in the uninitialized state. +

Additional operations are useful, such as converting constructors and converting @@ -252,7 +253,7 @@ via a pointer to the wrapped object or null.

-
+
@@ -292,7 +293,7 @@ itself which are supported by a special interface.

- + Lexically-hinted Value Access in the presence of possibly untitialized optional objects: The operators * and -> @@ -357,7 +358,7 @@ incarnated by pointers.

- + Optional<T> as a model of OptionalPointee
@@ -367,9 +368,9 @@ about the possibly uninitialized state appealing to the familiar pointer semantics w.r.t. to null pointers.

-
+
- +
[Warning][Warning] Warning

@@ -398,7 +399,7 @@ -


-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/examples.html b/doc/html/boost_optional/examples.html index 95c4ab1..7773534 100644 --- a/doc/html/boost_optional/examples.html +++ b/doc/html/boost_optional/examples.html @@ -1,11 +1,11 @@ - + Examples - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+ -
+

Optional return values @@ -57,7 +57,7 @@ }

-
+

Optional local variables @@ -78,7 +78,7 @@ else print("employer's name not found!");

-
+

Optional data members @@ -116,7 +116,7 @@ };

-
+
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index cf3577e..98b37fa 100644 --- a/doc/html/boost_optional/exception_safety_guarantees.html +++ b/doc/html/boost_optional/exception_safety_guarantees.html @@ -1,11 +1,11 @@ - + Exception Safety Guarantees - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+

Exception Safety Guarantees @@ -32,20 +32,28 @@ Notes), all of the assignment methods:

    -
  • optional<T>::operator= ( optional<T> - const& - )
  • -
  • optional<T>::operator= ( T const& )
  • -
  • template<class U> optional<T>::operator= ( optional<U> - const& - )
  • -
  • template<class InPlaceFactory> optional<T>::operator= ( InPlaceFactory - const& - )
  • -
  • template<class TypedInPlaceFactory> optional<T>::operator= ( TypedInPlaceFactory - const& - )
  • -
  • optional<T>:::reset ( T const&)
  • +
  • + optional<T>::operator= ( optional<T> const& ) +
  • +
  • + optional<T>::operator= ( T const& ) +
  • +
  • + template<class U> optional<T>::operator= ( optional<U> const& ) +
  • +
  • + template<class InPlaceFactory> optional<T>::operator= ( InPlaceFactory + const& + ) +
  • +
  • + template<class TypedInPlaceFactory> optional<T>::operator= ( TypedInPlaceFactory + const& + ) +
  • +
  • + optional<T>:::reset ( T const&) +

Can only guarantee the basic @@ -57,8 +65,12 @@ On the other hand, the uninitializing methods:

    -
  • optional<T>::operator= ( detail::none_t )
  • -
  • optional<T>::reset()
  • +
  • + optional<T>::operator= ( detail::none_t ) +
  • +
  • + optional<T>::reset() +

Provide the no-throw guarantee (assuming a no-throw T::~T()) @@ -112,7 +124,7 @@ }

- + Swap

@@ -126,7 +138,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index bdaa201..08374b1 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -1,11 +1,11 @@ - + Implementation Notes - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -41,7 +41,7 @@
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index e23a41b..87ee45c 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -1,11 +1,11 @@ - + In-Place Factories - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -129,14 +129,14 @@

  • -TypedInPlaceFactories: those which - take the target type as a primary template parameter. -
  • + TypedInPlaceFactories: those which + take the target type as a primary template parameter. +
  • -InPlaceFactories: those with a template - construct(void*) member - function taking the target type. -
  • + InPlaceFactories: those with a template + construct(void*) member + function taking the target type. +

Within each group, all the family members differ only in the number of parameters @@ -182,7 +182,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html index 9222d48..d50412b 100644 --- a/doc/html/boost_optional/optional_references.html +++ b/doc/html/boost_optional/optional_references.html @@ -1,11 +1,11 @@ - + Optional references - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -37,20 +37,20 @@

  • - Converting constructors -
  • + Converting constructors +
  • - Converting assignment -
  • + Converting assignment +
  • - InPlace construction -
  • + InPlace construction +
  • - InPlace assignment -
  • + InPlace assignment +
  • - Value-access via pointer -
  • + Value-access via pointer +

Also, even though optional<T&> @@ -59,19 +59,19 @@

  • - Copies of optional<T&> - will copy the references but all these references will nonetheless reefer - to the same object. -
  • + Copies of optional<T&> + will copy the references but all these references will nonetheless reefer + to the same object. +
  • - Value-access will actually provide access to the referenced object rather - than the reference itself. -
  • + Value-access will actually provide access to the referenced object rather + than the reference itself. +
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 4f06a6c..92b6700 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -1,11 +1,11 @@ - + Rebinding semantics for assignment of optional references - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+

Rebinding semantics for assignment of optional references @@ -70,7 +70,7 @@ assert(b==3);

- + Rationale

@@ -134,7 +134,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index 32472d3..e8ec559 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -1,11 +1,11 @@ - + Synopsis - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -136,7 +136,7 @@
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index aae6ec9..4161174 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -1,11 +1,11 @@ - + Type requirements - - + + @@ -13,16 +13,16 @@ - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-PrevUpHomeNext +PrevUpHomeNext
-
+
@@ -39,7 +39,7 @@
-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/index.html b/doc/html/index.html index 981800c..14c4e6a 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,33 +1,33 @@ - -Chapter 1. Boost.Optional + +Chapter 1. Boost.Optional - + - +
Boost C++ Libraries HomeLibrariesLibraries People FAQ More

-
Next
-
+
Next
+

-Chapter 1. Boost.Optional

+Chapter 1. Boost.Optional

Fernando Luis Cacciola Carballal

-
-
-

+

+
+

Distributed under 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)

@@ -71,7 +71,7 @@
Acknowledgments
-
+
@@ -81,15 +81,14 @@

  • - (A) double sqrt(double n - ); -
  • + (A) double sqrt(double n ); +
  • - (B) char get_async_input(); -
  • + (B) char get_async_input(); +
  • - (C) point polygon::get_any_point_effectively_inside(); -
  • + (C) point polygon::get_any_point_effectively_inside(); +

There are different approaches to the issue of not having a value to return. @@ -162,14 +161,12 @@ Clearly, we need a better idiom.

-

-

- +

Last revised: November 20, 2009 at 10:24:28 GMT

Last revised: April 06, 2011 at 20:44:42 GMT


-
Next
+
Next
diff --git a/doc/reference.qbk b/doc/reference.qbk index ea41210..97abcad 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -500,6 +500,23 @@ assert ( *opt1 == static_cast(v) ) ; __SPACE__ +[#reference_optional_operator_equal_factory] + +[: `template optional& optional::operator=( InPlaceFactory const& f );`] +[: `template optional& optional::operator=( TypedInPlaceFactory const& f );`] + +* [*Effect:] Assigns an `optional` with a value of `T` obtained from the +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] +* [*Exception Safety:] Exceptions can only be thrown during the call to +the `T` constructor used by the factory; in that case, the `optional` object +will be left empty. + +__SPACE__ + [#reference_optional_reset_value] [: `void optional::reset( T const& v ) ;`] From c1d2381a9b17f8900b0af088b79f9e144cdb4bc0 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 6 Apr 2011 21:56:23 +0000 Subject: [PATCH 02/18] Copy-editing optional documentation. Fixes #5382 and a few other issues I noticed while I was at it. [SVN r71052] --- doc/development.qbk | 8 ++++---- doc/html/boost_optional/detailed_semantics.html | 5 ++--- doc/html/boost_optional/development.html | 6 +++--- doc/html/index.html | 6 +++--- doc/optional.qbk | 2 +- doc/reference.qbk | 4 ++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/doc/development.qbk b/doc/development.qbk index cd00e45..9340407 100644 --- a/doc/development.qbk +++ b/doc/development.qbk @@ -1,4 +1,4 @@ -[/ +[/ Boost.Optional Copyright (c) 2003-2007 Fernando Luis Cacciola Carballal @@ -58,7 +58,7 @@ The observation made in the last paragraph about the irrelevant nature of the additional `nil_t` with respect to [_purpose] of `optional` suggests an alternative model: a ['container] that either has a value of `T` or nothing. -As of this writing I don't know of any precedence for a variable-size +As of this writing I don't know of any precedent for a variable-size fixed-capacity (of 1) stack-based container model for optional values, yet I believe this is the consequence of the lack of practical implementations of such a container rather than an inherent shortcoming of the container model. @@ -176,14 +176,14 @@ untitialized optional objects: The operators * and ->] A relevant feature of a pointer is that it can have a [*null pointer value]. This is a ['special] value which is used to indicate that the pointer is not referring to any object at all. In other words, null pointer values convey -the notion of inexistent objects. +the notion of nonexistent objects. This meaning of the null pointer value allowed pointers to became a ['de facto] standard for handling optional objects because all you have to do to refer to a value which you don't really have is to use a null pointer value of the appropriate type. Pointers have been used for decades—from the days of C APIs to modern C++ libraries—to ['refer] to optional (that is, -possibly inexistent) objects; particularly as optional arguments to a +possibly nonexistent) objects; particularly as optional arguments to a function, but also quite often as optional data members. The possible presence of a null pointer value makes the operations that diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index e48adcb..311e243 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -217,8 +217,7 @@ otherwise, same as:

- optional<T ['(not a - ref)]>::optional() + optional<T (not a ref)>::optional()

optional<T&> ::optional() @@ -712,7 +711,7 @@ Exception Safety: Exceptions can only be thrown during the call to the T constructor used by the factory; in that case, the optional - object will be left empty. + object will be reset to be uninitialized.

diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html index 159fd33..4c870d6 100644 --- a/doc/html/boost_optional/development.html +++ b/doc/html/boost_optional/development.html @@ -96,7 +96,7 @@ value of T or nothing.

- As of this writing I don't know of any precedence for a variable-size fixed-capacity + As of this writing I don't know of any precedent for a variable-size fixed-capacity (of 1) stack-based container model for optional values, yet I believe this is the consequence of the lack of practical implementations of such a container rather than an inherent shortcoming of the container model. @@ -302,7 +302,7 @@ A relevant feature of a pointer is that it can have a null pointer value. This is a special value which is used to indicate that the pointer is not referring to any object at all. - In other words, null pointer values convey the notion of inexistent objects. + In other words, null pointer values convey the notion of nonexistent objects.

This meaning of the null pointer value allowed pointers to became a de @@ -310,7 +310,7 @@ to do to refer to a value which you don't really have is to use a null pointer value of the appropriate type. Pointers have been used for decades—from the days of C APIs to modern C++ libraries—to refer - to optional (that is, possibly inexistent) objects; particularly as optional + to optional (that is, possibly nonexistent) objects; particularly as optional arguments to a function, but also quite often as optional data members.

diff --git a/doc/html/index.html b/doc/html/index.html index 14c4e6a..0ea03c2 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -27,7 +27,7 @@

-

+

Distributed under 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)

@@ -145,7 +145,7 @@ std::pair<point,bool> polygon::get_any_point_effectively_inside();

- These functions use a consistent interface for dealing with possibly inexistent + These functions use a consistent interface for dealing with possibly nonexistent results:

std::pair<point,bool> p = poly.get_any_point_effectively_inside();
@@ -163,7 +163,7 @@
 
- +

Last revised: April 06, 2011 at 20:44:42 GMT

Last revised: April 06, 2011 at 21:53:26 GMT


diff --git a/doc/optional.qbk b/doc/optional.qbk index 5217e49..fc65f14 100644 --- a/doc/optional.qbk +++ b/doc/optional.qbk @@ -99,7 +99,7 @@ functions could have the following interface: std::pair get_async_input(); std::pair polygon::get_any_point_effectively_inside(); -These functions use a consistent interface for dealing with possibly inexistent +These functions use a consistent interface for dealing with possibly nonexistent results: std::pair p = poly.get_any_point_effectively_inside(); diff --git a/doc/reference.qbk b/doc/reference.qbk index 97abcad..d1c9221 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -232,7 +232,7 @@ __SPACE__ * otherwise, same as: -[: `optional::optional()`] +[: `optional::optional()`] [: `optional ::optional()`] __SPACE__ @@ -513,7 +513,7 @@ from the factory `f` (i.e., the value [_is not copied]). * [*Notes:] See [link boost_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, the `optional` object -will be left empty. +will be reset to be ['uninitialized]. __SPACE__ From f9c46f9a8698fcbbd7094949149a760ac8b5aa5c Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 7 Apr 2011 19:56:55 +0000 Subject: [PATCH 03/18] Fix some more typos and grammatical errors. [SVN r71089] --- doc/html/boost_optional/detailed_semantics.html | 3 +-- ...cs_for_assignment_of_optional_references.html | 16 ++++++++-------- doc/html/index.html | 4 ++-- doc/reference.qbk | 4 ++-- doc/special_cases.qbk | 16 ++++++++-------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index 311e243..223d0c9 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -474,13 +474,12 @@

optional<T&>& optional<T&>::operator= ( T& - const& rhs ) ;

  • - Effect: (Re)binds thee wrapped reference. + Effect: (Re)binds the wrapped reference.
  • Postconditions: *this is initialized and it references the diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 92b6700..5272f40 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -42,7 +42,7 @@

    If you assign to a bare C++ reference, the assignment is forwarded to the referenced - object; it's value changes but the reference is never rebound. + object; its value changes but the reference is never rebound.

    int a = 1 ;
     int& ra = a ;
    @@ -117,16 +117,16 @@
           or not.
         

    - That is, you would have to discriminate in order to be consistency. + That is, you would have to discriminate in order to be consistent.

    - If in your code rebinding to another object is not an option, then is very - likely that binding for the fist time isn't either. In such case, assignment + If in your code rebinding to another object is not an option, then it is very + likely that binding for the first time isn't either. In such case, assignment to an uninitialized optional<T&> - shall be prohibited. It is quite possible that in such scenario the precondition - that the lvalue must be already initialized exist. If it doesn't, then binding - for the first time is OK while rebinding is not which is IMO very unlikely. - In such scenario, you can assign the value itself directly, as in: + shall be prohibited. It is quite possible that in such a scenario it is a precondition + that the lvalue must be already initialized. If it isn't, then binding for + the first time is OK while rebinding is not which is IMO very unlikely. In + such a scenario, you can assign the value itself directly, as in:

    assert(!!opt);
     *opt=value;
    diff --git a/doc/html/index.html b/doc/html/index.html
    index 0ea03c2..abfb2b1 100644
    --- a/doc/html/index.html
    +++ b/doc/html/index.html
    @@ -27,7 +27,7 @@
     
-

+

Distributed under 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)

@@ -163,7 +163,7 @@
- +

Last revised: April 06, 2011 at 21:53:26 GMT

Last revised: April 07, 2011 at 19:52:21 GMT


diff --git a/doc/reference.qbk b/doc/reference.qbk index d1c9221..23cae2d 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -379,9 +379,9 @@ assert ( *opt == y ) ; __SPACE__ -[: `optional& optional::operator= ( T& const& rhs ) ;`] +[: `optional& optional::operator= ( T& rhs ) ;`] -* [*Effect:] (Re)binds thee wrapped reference. +* [*Effect:] (Re)binds the wrapped reference. * [*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. diff --git a/doc/special_cases.qbk b/doc/special_cases.qbk index 07f1039..9975243 100644 --- a/doc/special_cases.qbk +++ b/doc/special_cases.qbk @@ -1,4 +1,4 @@ - + [section Optional references] This library allows the template parameter `T` to be of reference type: @@ -37,7 +37,7 @@ the first time) to the object. Clearly, there is no other choice. assert(x==2); If you assign to a bare C++ reference, the assignment is forwarded to the -referenced object; it's value changes but the reference is never rebound. +referenced object; its value changes but the reference is never rebound. int a = 1 ; int& ra = a ; @@ -95,15 +95,15 @@ use Optional's assignment without explicitly handling the previous initialization state unless your code is capable of functioning whether after the assignment, `a` aliases the same object as `b` or not. -That is, you would have to discriminate in order to be consistency. +That is, you would have to discriminate in order to be consistent. -If in your code rebinding to another object is not an option, then is very -likely that binding for the fist time isn't either. In such case, assignment +If in your code rebinding to another object is not an option, then it is very +likely that binding for the first time isn't either. In such case, assignment to an ['uninitialized ] `optional` shall be prohibited. It is quite possible -that in such scenario the precondition that the lvalue must be already -initialized exist. If it doesn't, then binding for the first time is OK +that in such a scenario it is a precondition that the lvalue must be already +initialized. If it isn't, then binding for the first time is OK while rebinding is not which is IMO very unlikely. -In such scenario, you can assign the value itself directly, as in: +In such a scenario, you can assign the value itself directly, as in: assert(!!opt); *opt=value; From f921762bf6821fe17c5d1474979db68361acdbcd Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 7 Apr 2011 21:05:15 +0000 Subject: [PATCH 04/18] Add link to header from synopsis. Fixes #4049. Add links to in place factory assignment operators. [SVN r71092] --- doc/html/boost_optional/synopsis.html | 8 +++++--- doc/html/index.html | 4 ++-- doc/reference.qbk | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index e8ec559..8b08308 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -26,7 +26,9 @@ -
namespace boost {
+
// In Header: <boost/optional/optional.hpp>
+
+namespace boost {
 
 template<class T>
 class optional
@@ -60,9 +62,9 @@
 
     template<class U> optional& operator = ( optional<U> const& rhs ) ; R
 
-    template<class InPlaceFactory> optional& operator = ( InPlaceFactory const& f ) ; 
+    template<class InPlaceFactory> optional& operator = ( InPlaceFactory const& f ) ; R
 
-    template<class TypedInPlaceFactory> optional& operator = ( TypedInPlaceFactory const& f ) ; 
+    template<class TypedInPlaceFactory> optional& operator = ( TypedInPlaceFactory const& f ) ; R
 
     T const& get() const ; R
     T&       get() ; R
diff --git a/doc/html/index.html b/doc/html/index.html
index abfb2b1..cdd3189 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -27,7 +27,7 @@
 
-

+

Distributed under 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)

@@ -163,7 +163,7 @@
- +

Last revised: April 07, 2011 at 19:52:21 GMT

Last revised: April 07, 2011 at 21:02:08 GMT


diff --git a/doc/reference.qbk b/doc/reference.qbk index 23cae2d..84bc1bb 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -11,6 +11,8 @@ [section Synopsis] + ```// In Header: <`[@boost:/boost/optional/optional.hpp boost/optional/optional.hpp]'''>'''`` + namespace boost { template @@ -45,9 +47,9 @@ template optional& operator = ( optional const& rhs ) ; ``[link reference_optional_operator_equal_other_optional __GO_TO__]`` - template optional& operator = ( InPlaceFactory const& f ) ; ``[/[link reference_optional_operator_equal_factory __GO_TO__]]`` + template optional& operator = ( InPlaceFactory const& f ) ; ``[link reference_optional_operator_equal_factory __GO_TO__]`` - template optional& operator = ( TypedInPlaceFactory const& f ) ; ``[/[link reference_optional_operator_equal_factory __GO_TO__]]`` + template optional& operator = ( TypedInPlaceFactory const& f ) ; ``[link reference_optional_operator_equal_factory __GO_TO__]`` T const& get() const ; ``[link reference_optional_get __GO_TO__]`` T& get() ; ``[link reference_optional_get __GO_TO__]`` From f6db3d6bc3aba85672fc1249c891ca7f309f8413 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Sun, 21 Oct 2012 06:30:04 +0000 Subject: [PATCH 05/18] Optional: fix some unused parameter warnings [SVN r81031] --- include/boost/optional/optional.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index ec9006e..0d6dba4 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -890,12 +890,12 @@ bool operator >= ( optional const& x, none_t y ) template inline -bool operator == ( none_t x, optional const& y ) +bool operator == ( none_t , optional const& y ) { return equal_pointees(optional() ,y); } template inline -bool operator < ( none_t x, optional const& y ) +bool operator < ( none_t , optional const& y ) { return less_pointees(optional() ,y); } template From 181e56a70ae6119dba1c0dcd804d590c313a132d Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Feb 2013 18:21:04 +0000 Subject: [PATCH 06/18] Remove extra :'s. Fixes #7973. [SVN r82909] --- doc/special_cases.qbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/special_cases.qbk b/doc/special_cases.qbk index 9975243..681e517 100644 --- a/doc/special_cases.qbk +++ b/doc/special_cases.qbk @@ -120,7 +120,7 @@ a fully constructed object, often temporary, just to follow the copy from: struct X { - X ( int, std:::string ) ; + X ( int, std::string ) ; } ; class W @@ -291,7 +291,7 @@ Because of the current implementation (see [link boost_optional.implementation_n * `template optional::operator= ( optional const& )` * `template optional::operator= ( InPlaceFactory const& )` * `template optional::operator= ( TypedInPlaceFactory const& ) ` -* `optional:::reset ( T const&)` +* `optional::reset ( T const&)` Can only ['guarantee] the [_basic exception safety]: The lvalue optional is left [_uninitialized] if an exception is thrown (any previous value is ['first] From a5c2ab212508446d2ad3776985ee964834c6dd4e Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Feb 2013 18:28:38 +0000 Subject: [PATCH 07/18] Some doc typos. Fixes #7602. [SVN r82910] --- doc/reference.qbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/reference.qbk b/doc/reference.qbk index 84bc1bb..dd01a96 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -386,7 +386,7 @@ __SPACE__ * [*Effect:] (Re)binds the wrapped reference. * [*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. +* [*Notes:] If `*this` was initialized, it is ['rebound] to the new object. See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior. * [*Example:] `` @@ -445,7 +445,7 @@ __SPACE__ * [*Postconditions:] If `*rhs` is initialized, `*this` is initialized and it 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 +* [*Notes:] If `*this` was initialized and so is `*rhs`, `*this` is ['rebound] to the new object. See [link boost_optional.rebinding_semantics_for_assignment_of_optional_references here] for details on this behavior. * [*Example:] `` From ab0ffa1c011d89751095e13cbdfa5d030934fa07 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Feb 2013 18:44:59 +0000 Subject: [PATCH 08/18] Correct definition of operator unspecified-bool-type. Make reference for is_initialized point to this operator. Fixes #6364. [SVN r82911] --- doc/reference.qbk | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/doc/reference.qbk b/doc/reference.qbk index dd01a96..cd0234c 100644 --- a/doc/reference.qbk +++ b/doc/reference.qbk @@ -660,7 +660,7 @@ __SPACE__ [: `optional::operator `['unspecified-bool-type]`() const ;`] * [*Returns:] An unspecified value which if used on a boolean context -is equivalent to (`get() != 0`) +is equivalent to (`get_ptr() != 0`) * [*Throws:] Nothing. * [*Example:] `` @@ -697,15 +697,7 @@ __SPACE__ [: `bool optional::is_initialized() const ;`] -* [*Returns: ] `true` if the `optional` is initialized, `false` otherwise. -* [*Throws:] Nothing. -* [*Example:] -`` -optional def ; -assert ( !def.is_initialized() ); -optional opt ( v ) ; -assert ( opt.is_initialized() ); -`` +* [*Deprecated:] Same as `operator `['unspecified-bool-type]`() ;` __SPACE__ From e40c2654d96a8beb5c362bcdd77da4895fdc644f Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Feb 2013 18:50:29 +0000 Subject: [PATCH 09/18] Replace deprecated function reset in examples. Fixes #765. [SVN r82912] --- doc/examples.qbk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/examples.qbk b/doc/examples.qbk index 4bd7f6a..00dbd99 100644 --- a/doc/examples.qbk +++ b/doc/examples.qbk @@ -35,12 +35,12 @@ optional name ; if ( database.open() ) { - name.reset ( database.lookup(employer_name) ) ; + name = database.lookup(employer_name) ; } else { if ( can_ask_user ) - name.reset ( user.ask(employer_name) ) ; + name = user.ask(employer_name) ; } if ( name ) @@ -63,7 +63,7 @@ void clip_in_rect ( rect const& rect ) { .... - m_clipping_rect.reset ( rect ) ; // initialized here. + m_clipping_rect = rect ; // initialized here. } void draw ( canvas& cvs ) From ff48f2b3a011316122c362a19e60866420ddccd8 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Feb 2013 19:22:34 +0000 Subject: [PATCH 10/18] Work around msvc bug when explicitly destroying a class with a virtual base. Fixes #5940. [SVN r82915] --- include/boost/optional/optional.hpp | 2 +- test/optional_test.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 0d6dba4..071e07c 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -476,7 +476,7 @@ class optional_base : public optional_tag #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } #else - void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; } + void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; } #endif void destroy_impl ( is_reference_tag ) { m_initialized = false ; } diff --git a/test/optional_test.cpp b/test/optional_test.cpp index e2e0dd5..29a1229 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -840,11 +840,19 @@ void test_with_builtin_types() test_none( ARG(double) ) ; } +// MSVC < 11.0 doesn't destroy X when we call ptr->VBase::VBase. +// Make sure that we work around this bug. +struct VBase : virtual X +{ + VBase(int v) : X(v) {} +}; + void test_with_class_type() { TRACE( std::endl << BOOST_CURRENT_FUNCTION ); test_basics( ARG(X) ); + test_basics( ARG(VBase) ); test_conditional_ctor_and_get_valur_or( ARG(X) ); test_direct_value_manip( ARG(X) ); test_uninitialized_access( ARG(X) ); From e8853f23cd776a1599ee422de5355692ec4a1a6f Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Sat, 16 Feb 2013 02:48:46 +0000 Subject: [PATCH 11/18] Use __may_alias__ instead of may_alias. Fixes #6410. [SVN r82919] --- include/boost/optional/optional.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 071e07c..5d5870b 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -127,7 +127,7 @@ class aligned_storage union // This works around GCC warnings about breaking strict aliasing rules when casting storage address to T* #if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) - __attribute__((may_alias)) + __attribute__((__may_alias__)) #endif dummy_u { From 655eb739faf8069cefc21653d8e56cff765947e0 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Sat, 16 Feb 2013 19:32:20 +0000 Subject: [PATCH 12/18] Add a forward declaration of the ostream operator for optional. Fixes #2103. [SVN r82930] --- include/boost/optional/optional.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 5d5870b..7c65962 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -743,6 +744,11 @@ get_pointer ( optional& opt ) return opt.get_ptr() ; } +// Forward declaration to prevent operator safe-bool from being used. +template +std::basic_ostream& +operator<<(std::basic_ostream& out, optional const& v); + // optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). // WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. From cb092824722a650bfbc349490044280b1e8b9244 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Sat, 16 Feb 2013 19:42:42 +0000 Subject: [PATCH 13/18] Update optional documentation. [SVN r82931] --- .../a_note_about_optional_bool_.html | 14 +- doc/html/boost_optional/acknowledgments.html | 20 +- .../dependencies_and_portability.html | 4 +- .../boost_optional/detailed_semantics.html | 255 +++++++++--------- doc/html/boost_optional/development.html | 28 +- doc/html/boost_optional/examples.html | 36 +-- .../exception_safety_guarantees.html | 48 ++-- .../boost_optional/implementation_notes.html | 4 +- .../boost_optional/in_place_factories.html | 30 +-- .../boost_optional/optional_references.html | 8 +- ...for_assignment_of_optional_references.html | 32 +-- doc/html/boost_optional/synopsis.html | 50 ++-- .../boost_optional/type_requirements.html | 4 +- doc/html/index.html | 10 +- 14 files changed, 266 insertions(+), 277 deletions(-) diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index 7434cf9..ea12e75 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -3,7 +3,7 @@ A note about optional<bool> - + @@ -22,7 +22,7 @@
PrevUpHomeNext
-
+

A note about optional<bool> @@ -54,11 +54,11 @@ { optional<bool> v = try(); - // The following intended to pass the value of 'v' to foo(): - foo(v); - // But instead, the initialization state is passed - // due to a typo: it should have been foo(*v). -} + // The following intended to pass the value of 'v' to foo(): + foo(v); + // But instead, the initialization state is passed + // due to a typo: it should have been foo(*v). +}

The only implicit conversion is to bool, diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index 935ed0b..e67f2ff 100644 --- a/doc/html/boost_optional/acknowledgments.html +++ b/doc/html/boost_optional/acknowledgments.html @@ -3,7 +3,7 @@ Acknowledgments - + @@ -21,16 +21,16 @@

PrevUpHome
-
+
-

- - Pre-formal +

+ + Pre-formal review

-
    +
    • Peter Dimov suggested the name 'optional', and was the first to point out the need for aligned storage. @@ -64,12 +64,12 @@ Henney, David Abrahams, and others I can't recall.
    -

    - - Post-formal +

    + + Post-formal review

    -
      +
      • William Kempf carefully considered the originally proposed interface and suggested the new interface which is currently used. He also started and diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index 26c78f9..39828d4 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -3,7 +3,7 @@ Dependencies and Portability - + @@ -22,7 +22,7 @@
        PrevUpHomeNext
        -
        +

        Dependencies and Portability diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index 223d0c9..40d873a 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -3,7 +3,7 @@ Detailed Semantics - + @@ -22,7 +22,7 @@
        PrevUpHomeNext
        -
        +
        @@ -31,7 +31,7 @@ type, in the sequel, those entries whose semantic depends on T being of reference type or not will be distinguished using the following convention:

        -
          +
          • If the entry reads: optional<T(not a ref)>, the @@ -63,9 +63,9 @@

            space

            -

            - - optional +

            + + optional class member functions

            @@ -74,7 +74,7 @@

            optional<T>::optional();

            -
              +
              • Effect: Default-Constructs an optional.
              • @@ -89,7 +89,7 @@ called.
              • - Example: + Example:
                optional<T> def ;
                 assert ( !def ) ;
                 
                @@ -101,7 +101,7 @@

                optional<T>::optional( none_t );

                -
                  +
                  • Effect: Constructs an optional uninitialized. @@ -118,7 +118,7 @@ The expression boost::none denotes an instance of boost::none_t that can be used as the parameter.
                  • - Example: + Example:
                    #include <boost/none.hpp>
                     optional<T> n(none) ;
                     assert ( !n ) ;
                    @@ -131,7 +131,7 @@
                     

                    optional<T (not a ref)>::optional( T const& v )

                    -
                      +
                      • Effect: Directly-Constructs an optional.
                      • @@ -157,7 +157,7 @@ has no effect.
                      • - Example: + Example:
                        T v;
                         optional<T> opt(v);
                         assert ( *opt == v ) ;
                        @@ -170,7 +170,7 @@
                         

                        optional<T&>::optional( T& ref )

                        -
                          +
                          • Effect: Directly-Constructs an optional.
                          • @@ -183,13 +183,13 @@ Throws: Nothing.
                          • - Example: + Example:
                            T v;
                             T& vref = v ;
                             optional<T&> opt(vref);
                             assert ( *opt == v ) ;
                            -++ v ; // mutate referee
                            -assert (*opt == v);
                            +++ v ; // mutate referee
                            +assert (*opt == v);
                             
                          @@ -203,7 +203,7 @@ optional<T&> ::optional( bool condition, T& v ) ;

                        -
                        • +
                          • If condition is true, same as:

                          @@ -213,7 +213,7 @@ optional<T&> ::optional( T& v )

                          -
                          • +
                            • otherwise, same as:

                            @@ -228,7 +228,7 @@

                            optional<T (not a ref)>::optional( optional const& rhs );

                            -
                              +
                              • Effect: Copy-Constructs an optional.
                              • @@ -256,7 +256,7 @@ has no effect.
                              • - Example: + Example:
                                optional<T> uninit ;
                                 assert (!uninit);
                                 
                                @@ -277,7 +277,7 @@
                                 

                                optional<T&>::optional( optional const& rhs );

                                -
                                  +
                                  • Effect: Copy-Constructs an optional.
                                  • @@ -299,7 +299,7 @@ will reefer to the same object (they alias).
                                  • - Example: + Example:
                                    optional<T&> uninit ;
                                     assert (!uninit);
                                     
                                    @@ -327,7 +327,7 @@
                                             template<U> explicit optional<T
                                             (not a ref)>::optional( optional<U> const& rhs );
                                           

                            -
                              +
                              • Effect: Copy-Constructs an optional.
                              • @@ -359,7 +359,7 @@ has no effect.
                              • - Example: + Example:
                                optional<double> x(123.4);
                                 assert ( *x == 123.4 ) ;
                                 
                                @@ -381,7 +381,7 @@
                                         explicit optional<T
                                         (not a ref)>::optional( TypedInPlaceFactory const& f );
                                       

                              -
                                +
                                • Effect: Constructs an optional with a value of T obtained @@ -407,14 +407,14 @@ effect.
                                • - Example: + Example:
                                  class C { C ( char, double, std::string ) ; } ;
                                   
                                   C v('A',123.4,"hello");
                                   
                                  -optional<C> x( in_place   ('A', 123.4, "hello") ); // InPlaceFactory used
                                  -optional<C> y( in_place<C>('A', 123.4, "hello") ); // TypedInPlaceFactory used
                                  -
                                  +optional<C> x( in_place   ('A', 123.4, "hello") ); // InPlaceFactory used
                                  +optional<C> y( in_place<C>('A', 123.4, "hello") ); // TypedInPlaceFactory used
                                  +
                                   assert ( *x == v ) ;
                                   assert ( *y == v ) ;
                                   
                                  @@ -430,7 +430,7 @@ rhs ) ;

                                -
                                  +
                                  • Effect: Assigns the value rhs to an optional.
                                  • @@ -455,7 +455,7 @@ copy constructor fails, *this is left properly uninitialized.
                                  • - Example: + Example:
                                    T x;
                                     optional<T> def ;
                                     optional<T> opt(x) ;
                                    @@ -477,7 +477,7 @@
                                             rhs )
                                             ;
                                           

                                  -
                                    +
                                    • Effect: (Re)binds the wrapped reference.
                                    • @@ -486,12 +486,12 @@ same object referenced by rhs.
                                    • - Notes: If *this was initialized, is is rebound + Notes: If *this was initialized, it is rebound to the new object. See here for details on this behavior.
                                    • - Example: + Example:
                                      int a = 1 ;
                                       int b = 2 ;
                                       T& ra = a ;
                                      @@ -499,14 +499,14 @@
                                       optional<int&> def ;
                                       optional<int&> opt(ra) ;
                                       
                                      -def = rb ; // binds 'def' to 'b' through 'rb'
                                      -assert ( *def == b ) ;
                                      -*def = a ; // changes the value of 'b' to a copy of the value of 'a'
                                      -assert ( b == a ) ;
                                      +def = rb ; // binds 'def' to 'b' through 'rb'
                                      +assert ( *def == b ) ;
                                      +*def = a ; // changes the value of 'b' to a copy of the value of 'a'
                                      +assert ( b == a ) ;
                                       int c = 3;
                                       int& rc = c ;
                                      -opt = rc ; // REBINDS to 'c' through 'rc'
                                      -c = 4 ;
                                      +opt = rc ; // REBINDS to 'c' through 'rc'
                                      +c = 4 ;
                                       assert ( *opt == 4 ) ;
                                       
                                    • @@ -521,7 +521,7 @@ rhs ) ;

                                    -
                                      +
                                      • Effect: Assigns another optional to an optional.
                                      • @@ -555,15 +555,15 @@ copy constructor fails, *this is left properly uninitialized.
                                      • - Example: + Example:
                                        T v;
                                         optional<T> opt(v);
                                         optional<T> def ;
                                         
                                         opt = def ;
                                         assert ( !def ) ;
                                        -// previous value (copy of 'v') destroyed from within 'opt'.
                                        -
                                        +// previous value (copy of 'v') destroyed from within 'opt'. +

                      @@ -575,7 +575,7 @@ rhs ) ;

                    -
                      +
                      • Effect: (Re)binds thee wrapped reference.
                      • @@ -585,12 +585,13 @@ object).
                      • - Notes: If *this was initialized and so is *rhs, this - is is rebound to the new object. See here + Notes: If *this was initialized and so is *rhs, + *this + is rebound to the new object. See here for details on this behavior.
                      • - Example: + Example:
                        int a = 1 ;
                         int b = 2 ;
                         T& ra = a ;
                        @@ -599,15 +600,15 @@
                         optional<int&> ora(ra) ;
                         optional<int&> orb(rb) ;
                         
                        -def = orb ; // binds 'def' to 'b' through 'rb' wrapped within 'orb'
                        -assert ( *def == b ) ;
                        -*def = ora ; // changes the value of 'b' to a copy of the value of 'a'
                        -assert ( b == a ) ;
                        +def = orb ; // binds 'def' to 'b' through 'rb' wrapped within 'orb'
                        +assert ( *def == b ) ;
                        +*def = ora ; // changes the value of 'b' to a copy of the value of 'a'
                        +assert ( b == a ) ;
                         int c = 3;
                         int& rc = c ;
                         optional<int&> orc(rc) ;
                        -ora = orc ; // REBINDS ora to 'c' through 'rc'
                        -c = 4 ;
                        +ora = orc ; // REBINDS ora to 'c' through 'rc'
                        +c = 4 ;
                         assert ( *ora == 4 ) ;
                         
                      • @@ -622,7 +623,7 @@ rhs ) ;

                      -
                        +
                        • Effect: Assigns another convertible optional to an optional. @@ -662,7 +663,7 @@ converting constructor fails, *this is left properly uninitialized.
                        • - Example: + Example:
                          T v;
                           optional<T> opt0(v);
                           optional<U> opt1;
                          @@ -687,7 +688,7 @@
                                   const&
                                   f );
                                 

                        -
                          +
                          • Effect: Assigns an optional with a value of T obtained @@ -720,7 +721,7 @@ void optional<T (not a ref)>::reset( T const& v ) ;

                          -
                          • +
                            • Deprecated: same as operator= ( T const& v) @@ -732,7 +733,7 @@

                              void optional<T>::reset() ;

                              -
                              • +
                                • Deprecated: Same as operator=( detail::none_t );

                                @@ -765,7 +766,7 @@ (not a ref)> &) ;

                              -
                                +
                                • Requirements: *this is initialized
                                • @@ -781,7 +782,7 @@ BOOST_ASSERT().
                                • - Example: + Example:
                                  T v ;
                                   optional<T> opt ( v );
                                   T const& u = *opt;
                                  @@ -818,7 +819,7 @@
                                           (not a ref)>&
                                           o, T& default ) ;
                                         

                                -
                                  +
                                  • Returns: A reference to the contained value, if any, or default. @@ -827,7 +828,7 @@ Throws: Nothing.
                                  • - Example: + Example:
                                    T v, z ;
                                     optional<T> def;
                                     T const& y = def.get_value_or(z);
                                    @@ -867,7 +868,7 @@
                                             inline T& get ( optional<T&>
                                             &) ;
                                           

                                  -
                                    +
                                    • Requirements: *this is initialized
                                    • @@ -883,7 +884,7 @@ BOOST_ASSERT().
                                    • - Example: + Example:
                                      T v ;
                                       T& vref = v ;
                                       optional<T&> opt ( vref );
                                      @@ -916,7 +917,7 @@
                                               (not a ref)>
                                               &) ;
                                             

                                    -
                                      +
                                      • Returns: If *this is initialized, a pointer to the contained value; else 0 (null). @@ -930,7 +931,7 @@ so you should not hold nor delete this pointer
                                      • - Example: + Example:
                                        T v;
                                         optional<T> opt(v);
                                         optional<T> const copt(v);
                                        @@ -953,7 +954,7 @@
                                                 T*
                                                 optional<T (not a ref)>::operator ->() ;
                                               

                                      -
                                        +
                                        • Requirements: *this is initialized.
                                        • @@ -968,7 +969,7 @@ BOOST_ASSERT().
                                        • - Example: + Example:
                                          struct X { int mdata ; } ;
                                           X x ;
                                           optional<X> opt (x);
                                          @@ -982,16 +983,16 @@
                                           

                                          optional<T>::operator unspecified-bool-type() const ;

                                          -
                                            +
                                            • Returns: An unspecified value which if - used on a boolean context is equivalent to (get() != 0) + used on a boolean context is equivalent to (get_ptr() != 0)
                                            • Throws: Nothing.
                                            • - Example: + Example:
                                              optional<T> def ;
                                               assert ( def == 0 );
                                               optional<T> opt ( v ) ;
                                              @@ -1006,7 +1007,7 @@
                                               

                                              bool optional<T>::operator!() ;

                                              -
                                                +
                                                • Returns: If *this is uninitialized, true; else false. @@ -1020,13 +1021,13 @@ in certain boolean contexts.
                                                • - Example: + Example:
                                                  optional<T> opt ;
                                                   assert ( !opt );
                                                   *opt = some_T ;
                                                   
                                                  -// Notice the "double-bang" idiom here.
                                                  -assert ( !!opt ) ;
                                                  +// Notice the "double-bang" idiom here.
                                                  +assert ( !!opt ) ;
                                                   
                                                @@ -1037,30 +1038,18 @@ bool optional<T>::is_initialized() const ;

                                              -
                                                -
                                              • - Returns: true - if the optional is initialized, - false otherwise. -
                                              • -
                                              • - Throws: Nothing. -
                                              • -
                                              • - Example: -
                                                optional<T> def ;
                                                -assert ( !def.is_initialized() );
                                                -optional<T> opt ( v ) ;
                                                -assert ( opt.is_initialized() );
                                                -
                                                -
                                              • -
                                              +
                                              • + Deprecated: Same as operator + unspecified-bool-type() + ; +

                                              space

                                              -

                                              - - Free functions +

                                              + + Free + functions

                                              space @@ -1068,17 +1057,17 @@

                                              optional<T (not a ref)> make_optional( T const& v )

                                              -
                                                +
                                                • Returns: optional<T>(v) for the deduced type T of v.
                                                • - Example: + Example:
                                                  template<class T> void foo ( optional<T> const& opt ) ;
                                                   
                                                  -foo ( make_optional(1+1) ) ; // Creates an optional<int>
                                                  -
                                                  +foo ( make_optional(1+1) ) ; // Creates an optional<int> +

                                            @@ -1087,14 +1076,14 @@

                                            optional<T (not a ref)> make_optional( bool condition, T const& v )

                                            -
                                              +
                                              • Returns: optional<T>(condition,v) for the deduced type T of v.
                                              • - Example: + Example:
                                                optional<double> calculate_foo()
                                                 {
                                                   double val = compute_foo();
                                                @@ -1116,7 +1105,7 @@
                                                         const&
                                                         y );
                                                       

                                              -
                                                +
                                                • Returns: If both x and y are initialized, @@ -1137,7 +1126,7 @@ instead
                                                • - Example: + Example:
                                                  T x(12);
                                                   T y(12);
                                                   T z(21);
                                                  @@ -1147,18 +1136,18 @@
                                                   optional<T> optY(y);
                                                   optional<T> optZ(z);
                                                   
                                                  -// Identity always hold
                                                  -assert ( def0 == def0 );
                                                  +// Identity always hold
                                                  +assert ( def0 == def0 );
                                                   assert ( optX == optX );
                                                   
                                                  -// Both uninitialized compare equal
                                                  -assert ( def0 == def1 );
                                                  +// Both uninitialized compare equal
                                                  +assert ( def0 == def1 );
                                                   
                                                  -// Only one initialized compare unequal.
                                                  -assert ( def0 != optX );
                                                  +// Only one initialized compare unequal.
                                                  +assert ( def0 != optX );
                                                   
                                                  -// Both initialized compare as (*lhs == *rhs)
                                                  -assert ( optX == optY ) ;
                                                  +// Both initialized compare as (*lhs == *rhs)
                                                  +assert ( optX == optY ) ;
                                                   assert ( optX != optZ ) ;
                                                   
                                                • @@ -1172,7 +1161,7 @@ const& y );

                                                -
                                                  +
                                                  • Returns: If y is not initialized, false. @@ -1194,25 +1183,25 @@ instead.
                                                  • - Example: + Example:
                                                    T x(12);
                                                     T y(34);
                                                     optional<T> def ;
                                                     optional<T> optX(x);
                                                     optional<T> optY(y);
                                                     
                                                    -// Identity always hold
                                                    -assert ( !(def < def) );
                                                    +// Identity always hold
                                                    +assert ( !(def < def) );
                                                     assert ( optX == optX );
                                                     
                                                    -// Both uninitialized compare equal
                                                    -assert ( def0 == def1 );
                                                    +// Both uninitialized compare equal
                                                    +assert ( def0 == def1 );
                                                     
                                                    -// Only one initialized compare unequal.
                                                    -assert ( def0 != optX );
                                                    +// Only one initialized compare unequal.
                                                    +assert ( def0 != optX );
                                                     
                                                    -// Both initialized compare as (*lhs == *rhs)
                                                    -assert ( optX == optY ) ;
                                                    +// Both initialized compare as (*lhs == *rhs)
                                                    +assert ( optX == optY ) ;
                                                     assert ( optX != optZ ) ;
                                                     
                                                  • @@ -1226,7 +1215,7 @@ const& y );

                                                  -
                                                    +
                                                    • Returns: !( x == @@ -1245,7 +1234,7 @@ const& y );

                                                    -
                                                      +
                                                      • Returns: ( y < @@ -1265,7 +1254,7 @@ const& y );

                                                      -
                                                        +
                                                        • Returns: !( y<x ); @@ -1284,7 +1273,7 @@ const& y );

                                                        -
                                                          +
                                                          • Returns: !( x<y ); @@ -1301,7 +1290,7 @@ ( optional<T>& x, optional<T>& y );

                                                          -
                                                            +
                                                            • Effect: If both x and y are initialized, @@ -1331,7 +1320,7 @@ If only one is initialized, it has the same basic guarantee as optional<T>::reset( T const& ).
                                                            • - Example: + Example:
                                                              T x(12);
                                                               T y(21);
                                                               optional<T> def0 ;
                                                              @@ -1339,14 +1328,14 @@
                                                               optional<T> optX(x);
                                                               optional<T> optY(y);
                                                               
                                                              -boost::swap(def0,def1); // no-op
                                                              -
                                                              +boost::swap(def0,def1); // no-op
                                                              +
                                                               boost::swap(def0,optX);
                                                               assert ( *def0 == x );
                                                               assert ( !optX );
                                                               
                                                              -boost::swap(def0,optX); // Get back to original values
                                                              -
                                                              +boost::swap(def0,optX); // Get back to original values
                                                              +
                                                               boost::swap(optX,optY);
                                                               assert ( *optX == y );
                                                               assert ( *optY == x );
                                                              diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html
                                                              index 4c870d6..d95699d 100644
                                                              --- a/doc/html/boost_optional/development.html
                                                              +++ b/doc/html/boost_optional/development.html
                                                              @@ -3,7 +3,7 @@
                                                               
                                                               Development
                                                               
                                                              -
                                                              +
                                                               
                                                               
                                                               
                                                              @@ -22,7 +22,7 @@
                                                               
                                                              PrevUpHomeNext
                                                              -
                                                              + -
                                                              +
                                                              @@ -110,7 +110,7 @@

                                                              Discriminated-union:

                                                              -
                                                                +
                                                                • deep-copy semantics: copies of the variant implies copies of the value. @@ -141,7 +141,7 @@

                                                                  Single-element container:

                                                                  -
                                                                    +
                                                                    • deep-copy semantics: copies of the container implies copies of the value. @@ -168,7 +168,7 @@
                                                                  -
                                                                  +
                                                                  @@ -193,7 +193,7 @@ We can draw from the purpose of optional<T> the required basic semantics:

                                                                  -
                                                            -
                                                            +

                                                            Optional local variables @@ -65,12 +65,12 @@
                                                            optional<string> name ;
                                                             if ( database.open() )
                                                             {
                                                            -    name.reset ( database.lookup(employer_name) ) ;
                                                            +    name = database.lookup(employer_name) ;
                                                             }
                                                             else
                                                             {
                                                                 if ( can_ask_user )
                                                            -        name.reset ( user.ask(employer_name) ) ;
                                                            +        name = user.ask(employer_name) ;
                                                             }
                                                             
                                                             if ( name )
                                                            @@ -78,7 +78,7 @@
                                                             else print("employer's name not found!");
                                                             

                                                            -
                                                            +

                                                            Optional data members @@ -89,14 +89,14 @@ figure() { - // data member 'm_clipping_rect' is uninitialized at this point. - } + // data member 'm_clipping_rect' is uninitialized at this point. + } void clip_in_rect ( rect const& rect ) { .... - m_clipping_rect.reset ( rect ) ; // initialized here. - } + m_clipping_rect = rect ; // initialized here. + } void draw ( canvas& cvs ) { @@ -106,8 +106,8 @@ cvs.drawXXX(..); } - // this can return NULL. - rect const* get_clipping_rect() { return get_pointer(m_clipping_rect); } + // this can return NULL. + rect const* get_clipping_rect() { return get_pointer(m_clipping_rect); } private : @@ -116,7 +116,7 @@ };

                                        -
                                        +

                                        Bypassing expensive unnecessary default construction diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index 98b37fa..9516647 100644 --- a/doc/html/boost_optional/exception_safety_guarantees.html +++ b/doc/html/boost_optional/exception_safety_guarantees.html @@ -3,7 +3,7 @@ Exception Safety Guarantees - + @@ -22,7 +22,7 @@
                                        PrevUpHomeNext
                                        -
                                        +

                                        Exception Safety Guarantees @@ -31,7 +31,7 @@ Because of the current implementation (see Implementation Notes), all of the assignment methods:

                                        -
                                          +
                                          • optional<T>::operator= ( optional<T> const& )
                                          • @@ -52,7 +52,7 @@ )
                                          • - optional<T>:::reset ( T const&) + optional<T>::reset ( T const&)

                                          @@ -64,7 +64,7 @@

                                          On the other hand, the uninitializing methods:

                                          -
                                            +
                                            • optional<T>::operator= ( detail::none_t )
                                            • @@ -84,10 +84,10 @@ know that optional's assignment and reset has the same guarantees.

                                              -
                                              //
                                              -// Case 1: Exception thrown during assignment.
                                              -//
                                              -T v0(123);
                                              +
                                              //
                                              +// Case 1: Exception thrown during assignment.
                                              +//
                                              +T v0(123);
                                               optional<T> opt0(v0);
                                               try
                                               {
                                              @@ -95,37 +95,37 @@
                                                   optional<T> opt1(v1);
                                                   opt0 = opt1 ;
                                               
                                              -    // If no exception was thrown, assignment succeeded.
                                              -    assert( *opt0 == v1 ) ;
                                              +    // If no exception was thrown, assignment succeeded.
                                              +    assert( *opt0 == v1 ) ;
                                               }
                                               catch(...)
                                               {
                                              -    // If any exception was thrown, 'opt0' is reset to uninitialized.
                                              -    assert( !opt0 ) ;
                                              +    // If any exception was thrown, 'opt0' is reset to uninitialized.
                                              +    assert( !opt0 ) ;
                                               }
                                               
                                              -//
                                              -// Case 2: Exception thrown during reset(v)
                                              -//
                                              -T v0(123);
                                              +//
                                              +// Case 2: Exception thrown during reset(v)
                                              +//
                                              +T v0(123);
                                               optional<T> opt(v0);
                                               try
                                               {
                                                   T v1(456);
                                                   opt.reset ( v1 ) ;
                                               
                                              -    // If no exception was thrown, reset succeeded.
                                              -    assert( *opt == v1 ) ;
                                              +    // If no exception was thrown, reset succeeded.
                                              +    assert( *opt == v1 ) ;
                                               }
                                               catch(...)
                                               {
                                              -    // If any exception was thrown, 'opt' is reset to uninitialized.
                                              -    assert( !opt ) ;
                                              +    // If any exception was thrown, 'opt' is reset to uninitialized.
                                              +    assert( !opt ) ;
                                               }
                                               
                                              -

                                              - - Swap +

                                              + + Swap

                                              void swap( optional<T>&, diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index 08374b1..4d004bb 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -3,7 +3,7 @@ Implementation Notes - + @@ -22,7 +22,7 @@

                                              PrevUpHomeNext
                                              -
                                              +
                                              diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index 87ee45c..9dc6374 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -3,7 +3,7 @@ In-Place Factories - + @@ -22,7 +22,7 @@
                                              PrevUpHomeNext
                                              -
                                              +
                                              @@ -36,7 +36,7 @@

                                              struct X
                                               {
                                              -    X ( int, std:::string ) ;
                                              +    X ( int, std::string ) ;
                                               } ;
                                               
                                               class W
                                              @@ -50,8 +50,8 @@
                                               
                                               void foo()
                                               {
                                              -    // Temporary object created.
                                              -    W ( X(123,"hello") ) ;
                                              +    // Temporary object created.
                                              +    W ( X(123,"hello") ) ;
                                               }
                                               

                                              @@ -71,9 +71,9 @@ void foo() { - // Wrapped object constructed in-place - // No temporary created. - W (123,"hello") ; + // Wrapped object constructed in-place + // No temporary created. + W (123,"hello") ; }

                                              @@ -119,15 +119,15 @@ void foo() { - // Wrapped object constructed in-place via a TypedInPlaceFactory. - // No temporary created. - W ( TypedInPlaceFactory2<X,int,std::string>(123,"hello")) ; + // Wrapped object constructed in-place via a TypedInPlaceFactory. + // No temporary created. + W ( TypedInPlaceFactory2<X,int,std::string>(123,"hello")) ; }

                    The factories are divided in two groups:

                    -
                      +
                      • TypedInPlaceFactories: those which take the target type as a primary template parameter. @@ -170,9 +170,9 @@ void foo() { - // Wrapped object constructed in-place via a InPlaceFactory. - // No temporary created. - W ( in_place(123,"hello") ) ; + // Wrapped object constructed in-place via a InPlaceFactory. + // No temporary created. + W ( in_place(123,"hello") ) ; }

                        diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html index d50412b..c5cbdcd 100644 --- a/doc/html/boost_optional/optional_references.html +++ b/doc/html/boost_optional/optional_references.html @@ -3,7 +3,7 @@ Optional references - + @@ -22,7 +22,7 @@

                        PrevUpHomeNext
                        -
                        +
                        @@ -35,7 +35,7 @@ However, since references are not real objects some restrictions apply and some operations are not available in this case:

                        -
                          +
                          • Converting constructors
                          • @@ -57,7 +57,7 @@ treats it wrapped pseudo-object much as a real value, a true real reference is stored so aliasing will ocurr:

                            -
                              +
                              • Copies of optional<T&> will copy the references but all these references will nonetheless reefer diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 5272f40..71c9b1c 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -3,7 +3,7 @@ Rebinding semantics for assignment of optional references - + @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                +

                                Rebinding semantics for assignment of optional references @@ -36,9 +36,9 @@ int& rx = x ; optional<int&> ora ; optional<int&> orb(x) ; -ora = orb ; // now 'ora' is bound to 'x' through 'rx' -*ora = 2 ; // Changes value of 'x' through 'ora' -assert(x==2); +ora = orb ; // now 'ora' is bound to 'x' through 'rx' +*ora = 2 ; // Changes value of 'x' through 'ora' +assert(x==2);

                                If you assign to a bare C++ reference, the assignment is forwarded to the referenced @@ -48,11 +48,11 @@ int& ra = a ; int b = 2 ; int& rb = b ; -ra = rb ; // Changes the value of 'a' to 'b' -assert(a==b); +ra = rb ; // Changes the value of 'a' to 'b' +assert(a==b); b = 3 ; -assert(ra!=b); // 'ra' is not rebound to 'b' - +assert(ra!=b); // 'ra' is not rebound to 'b' +

                                Now, if you assign to an initialized optional<T&>, the effect is to rebind to the new object @@ -64,14 +64,14 @@ int& rb = b ; optional<int&> ora(ra) ; optional<int&> orb(rb) ; -ora = orb ; // 'ora' is rebound to 'b' -*ora = 3 ; // Changes value of 'b' (not 'a') -assert(a==1); -assert(b==3); +ora = orb ; // 'ora' is rebound to 'b' +*ora = 3 ; // Changes value of 'b' (not 'a') +assert(a==1); +assert(b==3); -

                                - - Rationale +

                                + + Rationale

                                Rebinding semantics for the assignment of initialized diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index 8b08308..52a90ba 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -3,7 +3,7 @@ Synopsis - + @@ -22,7 +22,7 @@

                                PrevUpHomeNext
                                -
                                +
                                @@ -35,16 +35,16 @@ { public : - // (If T is of reference type, the parameters and results by reference are by value) - + // (If T is of reference type, the parameters and results by reference are by value) + optional () ; R optional ( none_t ) ; R optional ( T const& v ) ; R - // [new in 1.34] - optional ( bool condition, T const& v ) ; R + // [new in 1.34] + optional ( bool condition, T const& v ) ; R optional ( optional const& rhs ) ; R @@ -54,7 +54,7 @@ template<class TypedInPlaceFactory> explicit optional ( TypedInPlaceFactory const& f ) ; R - optional& operator = ( none_t ) ; + optional& operator = ( none_t ) ; optional& operator = ( T const& v ) ; R @@ -69,8 +69,8 @@ T const& get() const ; R T& get() ; R - // [new in 1.34] - T const& get_value_or( T const& default ) const ; R + // [new in 1.34] + T const& get_value_or( T const& default ) const ; R T const* operator ->() const ; R T* operator ->() ; R @@ -85,16 +85,16 @@ bool operator!() const ; R - // deprecated methods - - // (deprecated) - void reset() ; R + // deprecated methods - // (deprecated) - void reset ( T const& ) ; R + // (deprecated) + void reset() ; R - // (deprecated) - bool is_initialized() const ; R + // (deprecated) + void reset ( T const& ) ; R + + // (deprecated) + bool is_initialized() const ; R }; @@ -110,14 +110,14 @@ template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ; R -// [new in 1.34] -template<class T> inline optional<T> make_optional ( T const& v ) ; R +// [new in 1.34] +template<class T> inline optional<T> make_optional ( T const& v ) ; R -// [new in 1.34] -template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ; R +// [new in 1.34] +template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ; R -// [new in 1.34] -template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ; R +// [new in 1.34] +template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ; R template<class T> inline T const& get ( optional<T> const& opt ) ; R @@ -133,8 +133,8 @@ template<class T> inline void swap( optional<T>& x, optional<T>& y ) ; R -} // namespace boost - +} // namespace boost +
                                diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index 4161174..17a7c51 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -3,7 +3,7 @@ Type requirements - + @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                +
                                diff --git a/doc/html/index.html b/doc/html/index.html index cdd3189..39160e0 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Boost.Optional - + @@ -27,7 +27,7 @@
                                -

                                +

                                Distributed under 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)

                                @@ -71,7 +71,7 @@
                                Acknowledgments
                                -
                                +
                                @@ -79,7 +79,7 @@ Consider these functions which should return a value but which might not have a value to return:

                                -
                                  +
                                  • (A) double sqrt(double n );
                                  • @@ -163,7 +163,7 @@
                                - +

                                Last revised: April 07, 2011 at 21:02:08 GMT

                                Last revised: February 16, 2013 at 19:42:23 GMT


                                From 16657e5e1d0e70450435910d8b02f3fa76999868 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 15 Mar 2013 18:24:41 +0000 Subject: [PATCH 14/18] Try to fix VC8. [SVN r83445] --- test/optional_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/optional_test.cpp b/test/optional_test.cpp index 29a1229..c3f9355 100644 --- a/test/optional_test.cpp +++ b/test/optional_test.cpp @@ -845,6 +845,8 @@ void test_with_builtin_types() struct VBase : virtual X { VBase(int v) : X(v) {} + // MSVC 8.0 doesn't generate this correctly... + VBase(const VBase& other) : X(static_cast(other)) {} }; void test_with_class_type() From 931cf3941b073043909d9cb909563fcdd2ad0dcd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 30 Sep 2013 00:17:11 +0000 Subject: [PATCH 15/18] Optional: Remove obsolete MSVC version checks. [SVN r86019] --- include/boost/optional/optional.hpp | 32 +++-------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 7c65962..062a86f 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -39,31 +39,10 @@ #include -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) -// VC6.0 has the following bug: -// When a templated assignment operator exist, an implicit conversion -// constructing an optional is used when assigment of the form: -// optional opt ; opt = T(...); -// is compiled. -// However, optional's ctor is _explicit_ and the assignemt shouldn't compile. -// Therefore, for VC6.0 templated assignment is disabled. -// -#define BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -// VC7.0 has the following bug: -// When both a non-template and a template copy-ctor exist -// and the templated version is made 'explicit', the explicit is also -// given to the non-templated version, making the class non-implicitely-copyable. -// -#define BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) -// AFAICT only VC7.1 correctly resolves the overload set +#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) +// AFAICT only Intel 7 correctly resolves the overload set // that includes the in-place factory taking functions, -// so for the other VC versions, in-place factory support +// so for the other icc versions, in-place factory support // is disabled #define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT #endif @@ -530,7 +509,6 @@ class optional : public optional_detail::optional_base // Can throw if T::T(T const&) does optional ( bool cond, argument_type val ) : base(cond,val) {} -#ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR // NOTE: MSVC needs templated versions first // Creates a deep copy of another convertible optional @@ -544,7 +522,6 @@ class optional : public optional_detail::optional_base if ( rhs.is_initialized() ) this->construct(rhs.get()); } -#endif #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT // Creates an optional with an expression which can be either @@ -578,8 +555,6 @@ class optional : public optional_detail::optional_base } #endif - -#ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT // Assigns from another convertible optional (converts && deep-copies the rhs value) // Requires a valid conversion from U to T. // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED @@ -589,7 +564,6 @@ class optional : public optional_detail::optional_base this->assign(rhs); return *this ; } -#endif // Assigns from another optional (deep-copies the rhs value) // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED From c9ead3071327afa7e11d132570588f147441b958 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 30 Sep 2013 15:56:52 +0000 Subject: [PATCH 16/18] Remove use of obsolete BOOST_NO_TEMPLATED_STREAMS macro. It was only defined for no-longer-supported-gcc. [SVN r86062] --- include/boost/optional/optional_io.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index 9e0c807..a0ad4cf 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -33,15 +33,10 @@ namespace boost { -#if defined (BOOST_NO_TEMPLATED_STREAMS) -template -inline std::ostream& operator<<(std::ostream& out, optional const& v) -#else template inline std::basic_ostream& operator<<(std::basic_ostream& out, optional const& v) -#endif { if ( out.good() ) { @@ -53,15 +48,10 @@ operator<<(std::basic_ostream& out, optional const& v) return out; } -#if defined (BOOST_NO_TEMPLATED_STREAMS) -template -inline std::istream& operator>>(std::istream& in, optional& v) -#else template inline std::basic_istream& operator>>(std::basic_istream& in, optional& v) -#endif { if (in.good()) { From 3cf036366882a0db36f8760a2ceb8d384905f0ea Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 30 Sep 2013 15:58:48 +0000 Subject: [PATCH 17/18] Optional: Remove obsolete GCC version checks. [SVN r86068] --- include/boost/optional/optional.hpp | 3 +-- include/boost/optional/optional_io.hpp | 14 ++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 062a86f..603facd 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -63,8 +63,7 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 302 \ - && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) // GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with // regard to violation of the strict aliasing rules. The optional< T > storage type is marked // with this attribute in order to let the compiler know that it will alias objects of type T diff --git a/include/boost/optional/optional_io.hpp b/include/boost/optional/optional_io.hpp index a0ad4cf..4c1c610 100644 --- a/include/boost/optional/optional_io.hpp +++ b/include/boost/optional/optional_io.hpp @@ -12,18 +12,8 @@ #ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP -#if defined __GNUC__ -# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) -# define BOOST_OPTIONAL_NO_TEMPLATED_STREAMS -# endif -#endif // __GNUC__ - -#if defined BOOST_OPTIONAL_NO_TEMPLATED_STREAMS -# include -#else -# include -# include -#endif +#include +#include #include #include From 50d09367ca57f00af320127f1718b4253779e182 Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Fri, 11 Apr 2014 23:36:24 +0200 Subject: [PATCH 18/18] Rebuilt the HTML documentation using a newer xsltproc --- .../boost_optional/a_note_about_optional_bool_.html | 2 +- doc/html/boost_optional/acknowledgments.html | 2 +- .../boost_optional/dependencies_and_portability.html | 2 +- doc/html/boost_optional/detailed_semantics.html | 2 +- doc/html/boost_optional/development.html | 8 ++++---- doc/html/boost_optional/examples.html | 10 +++++----- .../boost_optional/exception_safety_guarantees.html | 2 +- doc/html/boost_optional/implementation_notes.html | 2 +- doc/html/boost_optional/in_place_factories.html | 2 +- doc/html/boost_optional/optional_references.html | 2 +- ...emantics_for_assignment_of_optional_references.html | 2 +- doc/html/boost_optional/synopsis.html | 2 +- doc/html/boost_optional/type_requirements.html | 2 +- doc/html/index.html | 4 ++-- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/html/boost_optional/a_note_about_optional_bool_.html b/doc/html/boost_optional/a_note_about_optional_bool_.html index ea12e75..8d70d49 100644 --- a/doc/html/boost_optional/a_note_about_optional_bool_.html +++ b/doc/html/boost_optional/a_note_about_optional_bool_.html @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                +

                                A note about optional<bool> diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index e67f2ff..d56c25c 100644 --- a/doc/html/boost_optional/acknowledgments.html +++ b/doc/html/boost_optional/acknowledgments.html @@ -21,7 +21,7 @@
                                PrevUpHome
                                -
                                +
                                diff --git a/doc/html/boost_optional/dependencies_and_portability.html b/doc/html/boost_optional/dependencies_and_portability.html index 39828d4..6fa31dd 100644 --- a/doc/html/boost_optional/dependencies_and_portability.html +++ b/doc/html/boost_optional/dependencies_and_portability.html @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                +

                                Dependencies and Portability diff --git a/doc/html/boost_optional/detailed_semantics.html b/doc/html/boost_optional/detailed_semantics.html index 40d873a..9f8b56b 100644 --- a/doc/html/boost_optional/detailed_semantics.html +++ b/doc/html/boost_optional/detailed_semantics.html @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                +
                                diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html index d95699d..7f21580 100644 --- a/doc/html/boost_optional/development.html +++ b/doc/html/boost_optional/development.html @@ -22,7 +22,7 @@
                                PrevUpHomeNext
                                -
                                + -
                                +
                                @@ -168,7 +168,7 @@

                            -
                            +
                            @@ -253,7 +253,7 @@ via a pointer to the wrapped object or null.

                            -
                            +
                            diff --git a/doc/html/boost_optional/examples.html b/doc/html/boost_optional/examples.html index 5c3a16f..54c3953 100644 --- a/doc/html/boost_optional/examples.html +++ b/doc/html/boost_optional/examples.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            + -
                            +

                            Optional return values @@ -57,7 +57,7 @@ }

                            -
                            +

                            Optional local variables @@ -78,7 +78,7 @@ else print("employer's name not found!");

                            -
                            +

                            Optional data members @@ -116,7 +116,7 @@ };

                            -
                            +

                            Bypassing expensive unnecessary default construction diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index 9516647..4ffa059 100644 --- a/doc/html/boost_optional/exception_safety_guarantees.html +++ b/doc/html/boost_optional/exception_safety_guarantees.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +

                            Exception Safety Guarantees diff --git a/doc/html/boost_optional/implementation_notes.html b/doc/html/boost_optional/implementation_notes.html index 4d004bb..fdec333 100644 --- a/doc/html/boost_optional/implementation_notes.html +++ b/doc/html/boost_optional/implementation_notes.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +
                            diff --git a/doc/html/boost_optional/in_place_factories.html b/doc/html/boost_optional/in_place_factories.html index 9dc6374..b13dcdf 100644 --- a/doc/html/boost_optional/in_place_factories.html +++ b/doc/html/boost_optional/in_place_factories.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +
                            diff --git a/doc/html/boost_optional/optional_references.html b/doc/html/boost_optional/optional_references.html index c5cbdcd..c6ad1e1 100644 --- a/doc/html/boost_optional/optional_references.html +++ b/doc/html/boost_optional/optional_references.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +
                            diff --git a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html index 71c9b1c..e9b21a4 100644 --- a/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html +++ b/doc/html/boost_optional/rebinding_semantics_for_assignment_of_optional_references.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +

                            Rebinding semantics for assignment of optional references diff --git a/doc/html/boost_optional/synopsis.html b/doc/html/boost_optional/synopsis.html index 52a90ba..ca3c1b6 100644 --- a/doc/html/boost_optional/synopsis.html +++ b/doc/html/boost_optional/synopsis.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +
                            diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index 17a7c51..e148299 100644 --- a/doc/html/boost_optional/type_requirements.html +++ b/doc/html/boost_optional/type_requirements.html @@ -22,7 +22,7 @@
                            PrevUpHomeNext
                            -
                            +
                            diff --git a/doc/html/index.html b/doc/html/index.html index 39160e0..12803e7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -71,7 +71,7 @@
                            Acknowledgments
                            -
                            +
                            @@ -163,7 +163,7 @@
                            - +

                            Last revised: February 16, 2013 at 19:42:23 GMT

                            Last revised: April 11, 2014 at 13:25:26 GMT