forked from boostorg/optional
Doc: added release notes section
This commit is contained in:
@ -91,6 +91,7 @@ This is how you solve it with `boost::optional`:
|
||||
[include 20_reference.qbk]
|
||||
[endsect]
|
||||
[include 90_dependencies.qbk]
|
||||
[include 91_acknowledgments.qbk]
|
||||
[include 91_relnotes.qbk]
|
||||
[include 92_acknowledgments.qbk]
|
||||
|
||||
|
||||
|
41
doc/91_relnotes.qbk
Normal file
41
doc/91_relnotes.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Boost.Optional
|
||||
|
||||
Copyright (c) 2015 Andrzej Krzemienski
|
||||
|
||||
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)
|
||||
]
|
||||
|
||||
|
||||
[section:relnotes Release Notes]
|
||||
|
||||
[heading Boost Release 1.58]
|
||||
|
||||
* `boost::none_t` is no longer convertible from literal `0`. This avoids a bug where `optional<rational<int>> oi = 0;` would initialize an optional object with no contained value.
|
||||
|
||||
|
||||
[heading Boost Release 1.57]
|
||||
|
||||
* [@https://github.com/boostorg/optional/pull/9 Git pull #9]: ['"Supply `<string>` to fix C++03 compile error on `logic_error("...")`"].
|
||||
|
||||
|
||||
[heading Boost Release 1.56]
|
||||
|
||||
* Added support for rvalue references. Now `optional<T>` works with moveable but non-copyable `T`'s,
|
||||
* Improved `swap` (now uses move operations),
|
||||
* Added function `emplace()`. This is the last of the requests from [@https://svn.boost.org/trac/boost/ticket/1841 Trac #1841],
|
||||
* `optional` is moveable, including conditional `noexcept` specifications, which make it `move_if_noexcept`-friendly,
|
||||
* Using explicit operator bool() on platforms that support it ([@https://svn.boost.org/trac/boost/ticket/4227 Trac #4227]) (breaking change),
|
||||
* Forward declaration of `operator<<(ostream&, optional const&)` to prevent inadvertent incorrect serialization of optional objects,
|
||||
* Removed deprecated function `reset()` from examples ([@https://svn.boost.org/trac/boost/ticket/9005 Trac #9005]),
|
||||
* Equality comparison with `boost::none` does not require that `T` be EqualityComparable,
|
||||
* Optional rvalue references are explicitly disallowed,
|
||||
* Binding temporaries to optional references is explicitly disallowed (breaking change),
|
||||
* More ways to access the contained value, functions `value()`, `value_or()`, `value_or_eval()`,
|
||||
* Updated and reorganized documentation, added tutorial and quick guide sections.
|
||||
|
||||
|
||||
|
||||
[endsect][/ relnotes]
|
@ -9,7 +9,7 @@
|
||||
]
|
||||
|
||||
|
||||
[section Acknowledgements]
|
||||
[section:acknowledgements Acknowledgements]
|
||||
|
||||
[heading Pre-formal review]
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../index.html" title="Boost.Optional">
|
||||
<link rel="up" href="../index.html" title="Boost.Optional">
|
||||
<link rel="prev" href="dependencies_and_portability/optional_reference_binding.html" title="Optional Reference Binding">
|
||||
<link rel="prev" href="relnotes.html" title="Release Notes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -19,7 +19,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="dependencies_and_portability/optional_reference_binding.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
|
||||
<a accesskey="p" href="relnotes.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
@ -124,7 +124,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="dependencies_and_portability/optional_reference_binding.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
|
||||
<a accesskey="p" href="relnotes.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../../index.html" title="Boost.Optional">
|
||||
<link rel="up" href="../dependencies_and_portability.html" title="Dependencies and Portability">
|
||||
<link rel="prev" href="../dependencies_and_portability.html" title="Dependencies and Portability">
|
||||
<link rel="next" href="../acknowledgements.html" title="Acknowledgements">
|
||||
<link rel="next" href="../relnotes.html" title="Release Notes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../acknowledgements.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../relnotes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -94,7 +94,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../acknowledgements.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dependencies_and_portability.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../relnotes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
119
doc/html/boost_optional/relnotes.html
Normal file
119
doc/html/boost_optional/relnotes.html
Normal file
@ -0,0 +1,119 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Release Notes</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../index.html" title="Boost.Optional">
|
||||
<link rel="up" href="../index.html" title="Boost.Optional">
|
||||
<link rel="prev" href="dependencies_and_portability/optional_reference_binding.html" title="Optional Reference Binding">
|
||||
<link rel="next" href="acknowledgements.html" title="Acknowledgements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="dependencies_and_portability/optional_reference_binding.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_optional.relnotes"></a><a class="link" href="relnotes.html" title="Release Notes">Release Notes</a>
|
||||
</h2></div></div></div>
|
||||
<h4>
|
||||
<a name="boost_optional.relnotes.h0"></a>
|
||||
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_58"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_58">Boost
|
||||
Release 1.58</a>
|
||||
</h4>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none_t</span></code> is no longer convertible from
|
||||
literal <code class="computeroutput"><span class="number">0</span></code>. This avoids a bug
|
||||
where <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="identifier">rational</span><span class="special"><</span><span class="keyword">int</span><span class="special">>></span> <span class="identifier">oi</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span></code> would
|
||||
initialize an optional object with no contained value.
|
||||
</li></ul></div>
|
||||
<h4>
|
||||
<a name="boost_optional.relnotes.h1"></a>
|
||||
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_57"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_57">Boost
|
||||
Release 1.57</a>
|
||||
</h4>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
<a href="https://github.com/boostorg/optional/pull/9" target="_top">Git pull #9</a>:
|
||||
<span class="emphasis"><em>"Supply <code class="computeroutput"><span class="special"><</span><span class="identifier">string</span><span class="special">></span></code>
|
||||
to fix C++03 compile error on <code class="computeroutput"><span class="identifier">logic_error</span><span class="special">(</span><span class="string">"..."</span><span class="special">)</span></code>"</em></span>.
|
||||
</li></ul></div>
|
||||
<h4>
|
||||
<a name="boost_optional.relnotes.h2"></a>
|
||||
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_56"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_56">Boost
|
||||
Release 1.56</a>
|
||||
</h4>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Added support for rvalue references. Now <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code> works with moveable but non-copyable
|
||||
<code class="computeroutput"><span class="identifier">T</span></code>'s,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Improved <code class="computeroutput"><span class="identifier">swap</span></code> (now uses
|
||||
move operations),
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Added function <code class="computeroutput"><span class="identifier">emplace</span><span class="special">()</span></code>. This is the last of the requests from
|
||||
<a href="https://svn.boost.org/trac/boost/ticket/1841" target="_top">Trac #1841</a>,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">optional</span></code> is moveable, including
|
||||
conditional <code class="computeroutput"><span class="keyword">noexcept</span></code> specifications,
|
||||
which make it <code class="computeroutput"><span class="identifier">move_if_noexcept</span></code>-friendly,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Using explicit operator bool() on platforms that support it (<a href="https://svn.boost.org/trac/boost/ticket/4227" target="_top">Trac
|
||||
#4227</a>) (breaking change),
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Forward declaration of <code class="computeroutput"><span class="keyword">operator</span><span class="special"><<(</span><span class="identifier">ostream</span><span class="special">&,</span> <span class="identifier">optional</span>
|
||||
<span class="keyword">const</span><span class="special">&)</span></code>
|
||||
to prevent inadvertent incorrect serialization of optional objects,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Removed deprecated function <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code> from examples (<a href="https://svn.boost.org/trac/boost/ticket/9005" target="_top">Trac
|
||||
#9005</a>),
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Equality comparison with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code>
|
||||
does not require that <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
be EqualityComparable,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Optional rvalue references are explicitly disallowed,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Binding temporaries to optional references is explicitly disallowed (breaking
|
||||
change),
|
||||
</li>
|
||||
<li class="listitem">
|
||||
More ways to access the contained value, functions <code class="computeroutput"><span class="identifier">value</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">value_or</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">value_or_eval</span><span class="special">()</span></code>,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Updated and reorganized documentation, added tutorial and quick guide sections.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2007 Fernando Luis Cacciola Carballal<br>Copyright © 2014 Andrzej Krzemieński<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="dependencies_and_portability/optional_reference_binding.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -86,6 +86,7 @@
|
||||
<dt><span class="section"><a href="boost_optional/dependencies_and_portability/optional_reference_binding.html">Optional
|
||||
Reference Binding</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_optional/relnotes.html">Release Notes</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_optional/acknowledgements.html">Acknowledgements</a></span></dt>
|
||||
</dl>
|
||||
</div>
|
||||
@ -136,7 +137,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: December 06, 2014 at 20:01:35 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: January 12, 2015 at 16:12:58 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014 Andrzej Krzemienski.
|
||||
// Copyright (C) 2014 - 2015 Andrzej Krzemienski.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -8,19 +8,7 @@
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// akrzemi1@gmail.com
|
||||
//
|
||||
// Revisions:
|
||||
//
|
||||
#include<iostream>
|
||||
#include<stdexcept>
|
||||
#include<string>
|
||||
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
|
||||
#include "boost/bind/apply.hpp" // Included just to test proper interaction with boost::apply<> as reported by Daniel Wallin
|
||||
#include "boost/mpl/bool.hpp"
|
||||
#include "boost/mpl/bool_fwd.hpp" // For mpl::true_ and mpl::false_
|
||||
#include "boost/static_assert.hpp"
|
||||
|
||||
#include "boost/optional/optional.hpp"
|
||||
|
||||
@ -28,11 +16,10 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "boost/none.hpp"
|
||||
#include "boost/core/lightweight_test.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
|
||||
#include "optional_test_common.cpp"
|
||||
using boost::optional;
|
||||
using boost::none;
|
||||
|
||||
//#ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT
|
||||
//#ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR
|
||||
@ -86,37 +73,37 @@ bool operator!=( Oracle const& a, Oracle const& b ) { return a.val.i != b.val.i;
|
||||
void test_move_ctor_from_U()
|
||||
{
|
||||
optional<Oracle> o1 ((OracleVal()));
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sValueMoveConstructed || o1->s == sMoveConstructed);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sValueMoveConstructed || o1->s == sMoveConstructed);
|
||||
|
||||
OracleVal v1;
|
||||
optional<Oracle> o2 (v1);
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sValueCopyConstructed || o2->s == sCopyConstructed || o2->s == sMoveConstructed );
|
||||
BOOST_CHECK(v1.s == sIntConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sValueCopyConstructed || o2->s == sCopyConstructed || o2->s == sMoveConstructed );
|
||||
BOOST_TEST(v1.s == sIntConstructed);
|
||||
|
||||
optional<Oracle> o3 (boost::move(v1));
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sValueMoveConstructed || o3->s == sMoveConstructed);
|
||||
BOOST_CHECK(v1.s == sMovedFrom);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sValueMoveConstructed || o3->s == sMoveConstructed);
|
||||
BOOST_TEST(v1.s == sMovedFrom);
|
||||
}
|
||||
|
||||
void test_move_ctor_form_T()
|
||||
{
|
||||
optional<Oracle> o1 ((Oracle()));
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sMoveConstructed);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sMoveConstructed);
|
||||
|
||||
Oracle v1;
|
||||
optional<Oracle> o2 (v1);
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sCopyConstructed);
|
||||
BOOST_CHECK(v1.s == sDefaultConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sCopyConstructed);
|
||||
BOOST_TEST(v1.s == sDefaultConstructed);
|
||||
|
||||
optional<Oracle> o3 (boost::move(v1));
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sMoveConstructed);
|
||||
BOOST_CHECK(v1.s == sMovedFrom);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sMoveConstructed);
|
||||
BOOST_TEST(v1.s == sMovedFrom);
|
||||
}
|
||||
|
||||
void test_move_ctor_from_optional_T()
|
||||
@ -124,22 +111,22 @@ void test_move_ctor_from_optional_T()
|
||||
optional<Oracle> o1;
|
||||
optional<Oracle> o2(boost::move(o1));
|
||||
|
||||
BOOST_CHECK(!o1);
|
||||
BOOST_CHECK(!o2);
|
||||
BOOST_TEST(!o1);
|
||||
BOOST_TEST(!o2);
|
||||
|
||||
optional<Oracle> o3((Oracle()));
|
||||
optional<Oracle> o4(boost::move(o3));
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o4);
|
||||
BOOST_CHECK(o3->s == sMovedFrom);
|
||||
BOOST_CHECK(o4->s == sMoveConstructed);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o4);
|
||||
BOOST_TEST(o3->s == sMovedFrom);
|
||||
BOOST_TEST(o4->s == sMoveConstructed);
|
||||
|
||||
optional<Oracle> o5((optional<Oracle>()));
|
||||
BOOST_CHECK(!o5);
|
||||
BOOST_TEST(!o5);
|
||||
|
||||
optional<Oracle> o6((optional<Oracle>(Oracle())));
|
||||
BOOST_CHECK(o6);
|
||||
BOOST_CHECK(o6->s == sMoveConstructed);
|
||||
BOOST_TEST(o6);
|
||||
BOOST_TEST(o6->s == sMoveConstructed);
|
||||
|
||||
optional<Oracle> o7(o6); // does copy ctor from non-const lvalue compile?
|
||||
}
|
||||
@ -149,59 +136,59 @@ void test_move_assign_from_U()
|
||||
optional<Oracle> o1 = boost::none; // test if additional ctors didn't break it
|
||||
o1 = boost::none; // test if additional assignments didn't break it
|
||||
o1 = OracleVal();
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_TEST(o1);
|
||||
|
||||
BOOST_CHECK(o1->s == sValueMoveConstructed);
|
||||
BOOST_TEST(o1->s == sValueMoveConstructed);
|
||||
|
||||
o1 = OracleVal();
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sMoveAssigned);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sMoveAssigned);
|
||||
|
||||
OracleVal v1;
|
||||
optional<Oracle> o2;
|
||||
o2 = v1;
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sValueCopyConstructed);
|
||||
BOOST_CHECK(v1.s == sIntConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sValueCopyConstructed);
|
||||
BOOST_TEST(v1.s == sIntConstructed);
|
||||
o2 = v1;
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sCopyAssigned || o2->s == sMoveAssigned);
|
||||
BOOST_CHECK(v1.s == sIntConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sCopyAssigned || o2->s == sMoveAssigned);
|
||||
BOOST_TEST(v1.s == sIntConstructed);
|
||||
|
||||
optional<Oracle> o3;
|
||||
o3 = boost::move(v1);
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sValueMoveConstructed);
|
||||
BOOST_CHECK(v1.s == sMovedFrom);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sValueMoveConstructed);
|
||||
BOOST_TEST(v1.s == sMovedFrom);
|
||||
}
|
||||
|
||||
void test_move_assign_from_T()
|
||||
{
|
||||
optional<Oracle> o1;
|
||||
o1 = Oracle();
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sMoveConstructed);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sMoveConstructed);
|
||||
|
||||
o1 = Oracle();
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sMoveAssigned);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sMoveAssigned);
|
||||
|
||||
Oracle v1;
|
||||
optional<Oracle> o2;
|
||||
o2 = v1;
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sCopyConstructed);
|
||||
BOOST_CHECK(v1.s == sDefaultConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sCopyConstructed);
|
||||
BOOST_TEST(v1.s == sDefaultConstructed);
|
||||
o2 = v1;
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sCopyAssigned);
|
||||
BOOST_CHECK(v1.s == sDefaultConstructed);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sCopyAssigned);
|
||||
BOOST_TEST(v1.s == sDefaultConstructed);
|
||||
|
||||
optional<Oracle> o3;
|
||||
o3 = boost::move(v1);
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sMoveConstructed);
|
||||
BOOST_CHECK(v1.s == sMovedFrom);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sMoveConstructed);
|
||||
BOOST_TEST(v1.s == sMovedFrom);
|
||||
}
|
||||
|
||||
void test_move_assign_from_optional_T()
|
||||
@ -209,23 +196,23 @@ void test_move_assign_from_optional_T()
|
||||
optional<Oracle> o1;
|
||||
optional<Oracle> o2;
|
||||
o1 = optional<Oracle>();
|
||||
BOOST_CHECK(!o1);
|
||||
BOOST_TEST(!o1);
|
||||
optional<Oracle> o3((Oracle()));
|
||||
o1 = o3;
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sMoveConstructed);
|
||||
BOOST_CHECK(o1);
|
||||
BOOST_CHECK(o1->s == sCopyConstructed);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sMoveConstructed);
|
||||
BOOST_TEST(o1);
|
||||
BOOST_TEST(o1->s == sCopyConstructed);
|
||||
|
||||
o2 = boost::move(o3);
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->s == sMovedFrom);
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sMoveConstructed);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->s == sMovedFrom);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sMoveConstructed);
|
||||
|
||||
o2 = optional<Oracle>((Oracle()));
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->s == sMoveAssigned);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->s == sMoveAssigned);
|
||||
}
|
||||
|
||||
class MoveOnly
|
||||
@ -247,21 +234,21 @@ void test_with_move_only()
|
||||
{
|
||||
optional<MoveOnly> o1;
|
||||
optional<MoveOnly> o2((MoveOnly(1)));
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->val == 1);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->val == 1);
|
||||
optional<MoveOnly> o3 (boost::move(o1));
|
||||
BOOST_CHECK(!o3);
|
||||
BOOST_TEST(!o3);
|
||||
optional<MoveOnly> o4 (boost::move(o2));
|
||||
BOOST_CHECK(o4);
|
||||
BOOST_CHECK(o4->val == 1);
|
||||
BOOST_CHECK(o2);
|
||||
BOOST_CHECK(o2->val == 0);
|
||||
BOOST_TEST(o4);
|
||||
BOOST_TEST(o4->val == 1);
|
||||
BOOST_TEST(o2);
|
||||
BOOST_TEST(o2->val == 0);
|
||||
|
||||
o3 = boost::move(o4);
|
||||
BOOST_CHECK(o3);
|
||||
BOOST_CHECK(o3->val == 1);
|
||||
BOOST_CHECK(o4);
|
||||
BOOST_CHECK(o4->val == 0);
|
||||
BOOST_TEST(o3);
|
||||
BOOST_TEST(o3->val == 1);
|
||||
BOOST_TEST(o4);
|
||||
BOOST_TEST(o4->val == 0);
|
||||
}
|
||||
|
||||
class MoveOnlyB
|
||||
@ -287,15 +274,15 @@ void test_move_assign_from_optional_U()
|
||||
optional<MoveOnlyB> b1;
|
||||
b1 = boost::move(a);
|
||||
|
||||
BOOST_CHECK(b1);
|
||||
BOOST_CHECK(b1->val == 2);
|
||||
BOOST_CHECK(a);
|
||||
BOOST_CHECK(a->val == 0);
|
||||
BOOST_TEST(b1);
|
||||
BOOST_TEST(b1->val == 2);
|
||||
BOOST_TEST(a);
|
||||
BOOST_TEST(a->val == 0);
|
||||
|
||||
b1 = MoveOnly(4);
|
||||
|
||||
BOOST_CHECK(b1);
|
||||
BOOST_CHECK(b1->val == 4);
|
||||
BOOST_TEST(b1);
|
||||
BOOST_TEST(b1->val == 4);
|
||||
}
|
||||
|
||||
void test_move_ctor_from_optional_U()
|
||||
@ -303,15 +290,15 @@ void test_move_ctor_from_optional_U()
|
||||
optional<MoveOnly> a((MoveOnly(2)));
|
||||
optional<MoveOnlyB> b1(boost::move(a));
|
||||
|
||||
BOOST_CHECK(b1);
|
||||
BOOST_CHECK(b1->val == 2);
|
||||
BOOST_CHECK(a);
|
||||
BOOST_CHECK(a->val == 0);
|
||||
BOOST_TEST(b1);
|
||||
BOOST_TEST(b1->val == 2);
|
||||
BOOST_TEST(a);
|
||||
BOOST_TEST(a->val == 0);
|
||||
|
||||
optional<MoveOnlyB> b2(( optional<MoveOnly>(( MoveOnly(4) )) ));
|
||||
|
||||
BOOST_CHECK(b2);
|
||||
BOOST_CHECK(b2->val == 4);
|
||||
BOOST_TEST(b2);
|
||||
BOOST_TEST(b2->val == 4);
|
||||
}
|
||||
|
||||
void test_swap()
|
||||
@ -320,8 +307,8 @@ void test_swap()
|
||||
optional<MoveOnly> b((MoveOnly(3)));
|
||||
swap(a, b);
|
||||
|
||||
BOOST_CHECK(a->val == 3);
|
||||
BOOST_CHECK(b->val == 2);
|
||||
BOOST_TEST(a->val == 3);
|
||||
BOOST_TEST(b->val == 2);
|
||||
}
|
||||
|
||||
void test_optional_ref_to_movables()
|
||||
@ -329,26 +316,24 @@ void test_optional_ref_to_movables()
|
||||
MoveOnly m(3);
|
||||
optional<MoveOnly&> orm = m;
|
||||
orm->val = 2;
|
||||
BOOST_CHECK(m.val == 2);
|
||||
BOOST_TEST(m.val == 2);
|
||||
|
||||
optional<MoveOnly&> orm2 = orm;
|
||||
orm2->val = 1;
|
||||
BOOST_CHECK(m.val == 1);
|
||||
BOOST_CHECK(orm->val == 1);
|
||||
BOOST_TEST(m.val == 1);
|
||||
BOOST_TEST(orm->val == 1);
|
||||
|
||||
optional<MoveOnly&> orm3 = boost::move(orm);
|
||||
orm3->val = 4;
|
||||
BOOST_CHECK(m.val == 4);
|
||||
BOOST_CHECK(orm->val == 4);
|
||||
BOOST_CHECK(orm2->val == 4);
|
||||
BOOST_TEST(m.val == 4);
|
||||
BOOST_TEST(orm->val == 4);
|
||||
BOOST_TEST(orm2->val == 4);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int test_main( int, char* [] )
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
test_move_ctor_from_U();
|
||||
test_move_ctor_form_T();
|
||||
@ -362,13 +347,6 @@ int test_main( int, char* [] )
|
||||
test_optional_ref_to_movables();
|
||||
test_swap();
|
||||
#endif
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
BOOST_ERROR("Unexpected Exception caught!");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user