[Boost-bugs] [Boost C++ Libraries] #12973: Example in docs for optional<T&> copy constructor is wrong

Subject: [Boost-bugs] [Boost C++ Libraries] #12973: Example in docs for optional<T&> copy constructor is wrong
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-04-14 21:52:55


#12973: Example in docs for optional<T&> copy constructor is wrong
------------------------------+-----------------------
 Reporter: barry.revzin@… | Owner: fcacciola
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: optional
  Version: Boost 1.63.0 | Severity: Cosmetic
 Keywords: |
------------------------------+-----------------------
 In the
 [http://www.boost.org/doc/libs/1_63_0/libs/optional/doc/html/boost_optional/reference/header__boost_optional_optional_hpp_/detailed_semantics.html
 documentation for Optional] in the latest version, and many past versions,
 the example in the copy constructor for `optional<T&>` reads:

 {{{
 T v = 2 ; T& ref = v ;
 optional<T> init(ref);
 assert ( *init == v ) ;

 optional<T> init2 ( init ) ;
 assert ( *init2 == v ) ;

 v = 3 ;

 assert ( *init == 3 ) ;
 assert ( *init2 == 3 ) ;
 }}}

 Both `init` and `init2` should be of type `optional<T&>`, not
 `optional<T>`.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12973>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-04-14 21:55:40 UTC