From 40a1ec1ca2334b36bac8e84469aae6a636661f8d Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Fri, 11 Apr 2014 17:38:56 +0200 Subject: [PATCH] Added HTML documentation generated from QuickBook sources (they were not in sync in the previous commit) --- .../a_note_about_optional_bool_.html | 28 +- doc/html/boost_optional/acknowledgments.html | 140 +- .../dependencies_and_portability.html | 18 +- .../boost_optional/detailed_semantics.html | 2116 +++++++---------- doc/html/boost_optional/development.html | 209 +- doc/html/boost_optional/examples.html | 50 +- .../exception_safety_guarantees.html | 104 +- .../boost_optional/implementation_notes.html | 18 +- .../boost_optional/in_place_factories.html | 58 +- .../boost_optional/optional_references.html | 56 +- ...for_assignment_of_optional_references.html | 62 +- doc/html/boost_optional/synopsis.html | 72 +- .../boost_optional/type_requirements.html | 18 +- doc/html/index.html | 47 +- 14 files changed, 1340 insertions(+), 1656 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..8d70d49 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> @@ -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, @@ -70,7 +70,7 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/acknowledgments.html b/doc/html/boost_optional/acknowledgments.html index bd09f61..d56c25c 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 +

+ + 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 +

    + + 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..6fa31dd 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..9f8b56b 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
    -
    +
    @@ -31,26 +31,26 @@ 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 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

      @@ -63,278 +63,201 @@

      space

      -

      - - optional +

      + + 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);
                +++ 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 ) - ; -

              -

              -

              -
              -
              • - 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() -

              -

              -

              -
              +

              + 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 ) +

              +
              • + otherwise, same as: +
              +

              + optional<T (not a ref)>::optional() +

              +

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

              space

              -

              -

              -
              -

              -

              -

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

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

              +
                +
              • + 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. +
              • +
              • + Throws: Whatever T::T( + T const& ) + throws. +
              • +
              • + Notes: If rhs is initialized, T::T(T const& ) + is called. +
              • +
              • + Exception Safety: Exceptions can only + be thrown during T::T( T const& - rhs ); -

                -

                -

                -
              -
                + ); in that case, this constructor + has no effect. +
              • -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. -
              • -
              • -Throws: Whatever T::T( - T const& ) throws. -
              • -
              • -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. -
              • -
              • -Example:
                optional<T> uninit ;
                +          Example:
                +
                optional<T> uninit ;
                 assert (!uninit);
                 
                 optional<T> uinit2 ( uninit ) ;
                @@ -346,43 +269,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,173 +318,145 @@
                   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");
                       
                      -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 ) ;
                       
                      -
                    • +

                    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,145 +466,133 @@
                         opt = y ;
                         assert ( *opt == y ) ;
                         
                        -
                      • +

                      space

                      -
                      -

                      -

                      -

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

                      -

                      -

                      -
                      -
                        +

                        + optional<T&>& + optional<T&>::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. -
                        • + 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, it 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 ;
                           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 ) ;
                           
                          -
                        • +

                        space

                        -

                        -

                        -
                        -

                        -

                        -

                        - optional& - optional<T (not a ref)>::operator= ( optional +

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

                        +
                          +
                        • + Effect: Assigns another optional to an optional. +
                        • +
                        • + Postconditions: If rhs + is initialized, *this + is initialized and its value is a copy of the value + of rhs; else *this is + uninitialized. +
                        • +
                        • + Throws: Whatever T::operator( T const&) + or T::T( T const& - rhs ) - ; -

                          -

                          -

                          -
                        -
                          + ) throws. +
                        • -Effect: Assigns another optional - to an optional. -
                        • + Notes: If both *this and rhs + are initially initialized, T's + assignment operator is used. If *this is initially initialized but rhs is uninitialized, T's + [destructor] is called. If *this is initially uninitialized but rhs is initialized, T's + copy constructor is called. +
                        • -Postconditions: If rhs - is initialized, *this - is initialized and its value is a copy of the value - of rhs; else *this is 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. +
                        • -Throws: Whatever T::operator( T const&) or T::T( - T const& ) throws. -
                        • -
                        • -Notes: If both *this and rhs - are initially initialized, T's - assignment operator is used. If *this is initially initialized but rhs is uninitialized, T's - [destructor] is called. If *this is initially uninitialized but rhs is initialized, T's - copy constructor is called. -
                        • -
                        • -Exception Safety: In the event of an exception, - the initialization state of *this is unchanged and its value unspecified - as far as optional is concerned (it is up to T's - operator=()). - If *this - is initially uninitialized and T's - copy constructor fails, *this is left properly uninitialized. -
                        • -
                        • -Example:
                          T v;
                          +          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'. + +

                        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 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 ;
                            @@ -722,202 +600,190 @@
                             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 ) ;
                             
                            -
                          • +

                          space

                          -

                          -

                          -
                          -

                          -

                          -

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

                          -

                          -

                          -
                          -
                            -
                          • -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. -
                          • -
                          • -Throws: Whatever T::operator=( U const& ) or - T::T( U +

                            + template<U> optional& + optional<T (not a ref)>::operator= ( optional<U> const& - ) throws. -

                          • + rhs ) + ; +

                          +
                          • -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. -
                          • + Effect: Assigns another convertible optional + to an optional. +
                          • -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. -
                          • + 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. +
                          • -Example:
                            T v;
                            +          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. +
                          • +
                          • + 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;
                             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) ; -

                          + f ); +

                        +

                        + template<TypedInPlaceFactory> + optional<T>& optional<T (not a ref)>::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 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 reset to be uninitialized. +
                        • +

                        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 +

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

                        +
                        • + Deprecated: same as operator= ( T const& - get ( - optional<T (not a ref)> const& ) ; -

                          + v) + ;
                          +

                        -

                        -
                        -
                        + space +

                        +

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

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

                        -

                        -

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

                        -

                        -

                        -
                        -
                          + 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 -
                          • + Requirements: *this is initialized +
                          • -Returns: A reference to the contained value -
                          • + Returns: A reference 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:
                            T v ;
                            +          Example:
                            +
                            T v ;
                             optional<T> opt ( v );
                             T const& u = *opt;
                             assert ( u == v ) ;
                            @@ -925,73 +791,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 +839,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 +893,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 +940,151 @@
                                   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_ptr() != 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 ) ;
                                        +// Notice the "double-bang" idiom here.
                                        +assert ( !!opt ) ;
                                         
                                        -
                                      • +

                                      space

                                      -

                                      -

                                      -
                                      -

                                      -

                                      -

                                      - 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() );
                                        -
                                        -
                                      • -
                                      +

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

                                      +
                                      • + Deprecated: Same as operator + unspecified-bool-type() + ; +

                                      space

                                      -

                                      - - Free functions +

                                      + + 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>
                                          -
                                          -
                                        • +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 +1094,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 ;
                                              @@ -1427,253 +1136,216 @@
                                               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 ) ;
                                               
                                              -
                                            • +

                                            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);
                                                 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 ) ;
                                                 
                                                -
                                              • +

                                              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 ;
                                                 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 );
                                                 
                                                -
                                              • +
                                            -

                                            -PrevUpHomeNext +PrevUpHomeNext
                                            diff --git a/doc/html/boost_optional/development.html b/doc/html/boost_optional/development.html index 7c96256..7f21580 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
                                            -
                                            + -
                                            +
                                            @@ -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. @@ -110,65 +110,65 @@

                                            Discriminated-union:

                                            -
                                              +
                                              • -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 +
                                              -
                                              +
                                              @@ -193,58 +193,59 @@ We can draw from the purpose of optional<T> the required basic semantics:

                                              -
                                                +
                                                • -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.

                                              -
                                              +
                                              @@ -291,9 +292,9 @@ operations not provided by T itself which are supported by a special interface.

                                              -
                                              - - Lexically-hinted +
                                              + + Lexically-hinted Value Access in the presence of possibly untitialized optional objects: The operators * and ->
                                              @@ -301,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 @@ -309,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.

                                              @@ -356,9 +357,9 @@ possible undefined value because of the idiomatic aid present in the OptionalPointee concept incarnated by pointers.

                                              -
                                              - - Optional<T> +
                                              + + 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..54c3953 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 @@ -45,19 +45,19 @@ { if ( !queue.empty() ) return optional<char>(queue.top()); - else return optional<char>(); // uninitialized -} + else return optional<char>(); // uninitialized +} void receive_async_message() { optional<char> rcv ; - // The safe boolean conversion from 'rcv' is used here. - while ( (rcv = get_async_input()) && !timeout() ) + // The safe boolean conversion from 'rcv' is used here. + while ( (rcv = get_async_input()) && !timeout() ) output(*rcv); }

                                              -
                                              +

                                              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 @@ };

                                              -
                                              +
                                              -

                                              -PrevUpHomeNext +PrevUpHomeNext
                                              diff --git a/doc/html/boost_optional/exception_safety_guarantees.html b/doc/html/boost_optional/exception_safety_guarantees.html index cf3577e..4ffa059 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 @@ -31,21 +31,29 @@ Because of the current implementation (see Implementation 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 @@ -56,9 +64,13 @@

                                                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()) @@ -72,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
                                                   {
                                                  @@ -83,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>&, @@ -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..fdec333 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..b13dcdf 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
                                                -
                                                +
                                                @@ -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,24 +119,24 @@ 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. -
                                                  • + 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 @@ -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") ) ; }

                                                  @@ -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..c6ad1e1 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
                                                -
                                                +
                                                @@ -35,43 +35,43 @@ However, since references are not real objects some restrictions apply and some operations are not available in this case:

                                                -
                                                  +
                                                  • - 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&> 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 - 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..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 @@ -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 @@ -36,23 +36,23 @@ 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 - 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 ;
                                                   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 @@ -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;
                                                  @@ -134,7 +134,7 @@
                                                   
                                                  -

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

                                                  -PrevUpHomeNext +PrevUpHomeNext
                                                  -
                                                  +
                                                  -
                                                  namespace boost {
                                                  +
                                                  // In Header: <boost/optional/optional.hpp>
                                                  +
                                                  +namespace boost {
                                                   
                                                   template<class T>
                                                   class optional
                                                   {
                                                       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
                                                   
                                                  @@ -52,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
                                                   
                                                  @@ -60,15 +62,15 @@
                                                   
                                                       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
                                                   
                                                  -    // [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
                                                  @@ -83,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
                                                   
                                                   };
                                                   
                                                  @@ -108,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
                                                   
                                                  @@ -131,12 +133,12 @@
                                                   
                                                   template<class T> inline void swap( optional<T>& x, optional<T>& y ) ; R
                                                   
                                                  -} // namespace boost
                                                  -
                                                  +} // namespace boost +
                                                  -

                                                  -PrevUpHomeNext +PrevUpHomeNext
                                                  diff --git a/doc/html/boost_optional/type_requirements.html b/doc/html/boost_optional/type_requirements.html index aae6ec9..e148299 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..12803e7 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
                                              -
                                              +
                                              @@ -79,17 +79,16 @@ Consider these functions which should return a value but which might not have a value to return:

                                              -
                                                +
                                                • - (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. @@ -146,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();
                                                @@ -162,14 +161,12 @@
                                                       Clearly, we need a better idiom.
                                                     

                                              -

                                              -

                                              - +

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

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


                                              -
                                              Next
                                              +
                                              Next