Boost C++ Libraries: Ticket #12973: Example in docs for optional<T&> copy constructor is wrong https://svn.boost.org/trac10/ticket/12973 <p> In the <a href="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</a> in the latest version, and many past versions, the example in the copy constructor for <code>optional&lt;T&amp;&gt;</code> reads: </p> <pre class="wiki">T v = 2 ; T&amp; ref = v ; optional&lt;T&gt; init(ref); assert ( *init == v ) ; optional&lt;T&gt; init2 ( init ) ; assert ( *init2 == v ) ; v = 3 ; assert ( *init == 3 ) ; assert ( *init2 == 3 ) ; </pre><p> Both <code>init</code> and <code>init2</code> should be of type <code>optional&lt;T&amp;&gt;</code>, not <code>optional&lt;T&gt;</code>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12973 Trac 1.4.3