From 35eaec5a52b47f305f3cadcf0546e76992fc344e Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Mon, 12 Jan 2015 17:37:15 +0100 Subject: [PATCH] Doc: added release notes section --- doc/00_optional.qbk | 3 +- doc/91_relnotes.qbk | 41 ++++ ...owledgments.qbk => 92_acknowledgments.qbk} | 2 +- doc/html/boost_optional/acknowledgements.html | 6 +- .../optional_reference_binding.html | 6 +- doc/html/boost_optional/relnotes.html | 119 ++++++++++ doc/html/index.html | 3 +- test/optional_test_move.cpp | 220 ++++++++---------- 8 files changed, 270 insertions(+), 130 deletions(-) create mode 100644 doc/91_relnotes.qbk rename doc/{91_acknowledgments.qbk => 92_acknowledgments.qbk} (98%) create mode 100644 doc/html/boost_optional/relnotes.html diff --git a/doc/00_optional.qbk b/doc/00_optional.qbk index 95c982f..2f940b7 100644 --- a/doc/00_optional.qbk +++ b/doc/00_optional.qbk @@ -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] diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk new file mode 100644 index 0000000..94a9c61 --- /dev/null +++ b/doc/91_relnotes.qbk @@ -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> 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 `` to fix C++03 compile error on `logic_error("...")`"]. + + +[heading Boost Release 1.56] + +* Added support for rvalue references. Now `optional` 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] diff --git a/doc/91_acknowledgments.qbk b/doc/92_acknowledgments.qbk similarity index 98% rename from doc/91_acknowledgments.qbk rename to doc/92_acknowledgments.qbk index cb1b3bb..f337ce2 100644 --- a/doc/91_acknowledgments.qbk +++ b/doc/92_acknowledgments.qbk @@ -9,7 +9,7 @@ ] -[section Acknowledgements] +[section:acknowledgements Acknowledgements] [heading Pre-formal review] diff --git a/doc/html/boost_optional/acknowledgements.html b/doc/html/boost_optional/acknowledgements.html index 659795d..9c8019a 100644 --- a/doc/html/boost_optional/acknowledgements.html +++ b/doc/html/boost_optional/acknowledgements.html @@ -6,7 +6,7 @@ - + @@ -19,7 +19,7 @@

-PrevUpHome +PrevUpHome

@@ -124,7 +124,7 @@
-PrevUpHome +PrevUpHome
diff --git a/doc/html/boost_optional/dependencies_and_portability/optional_reference_binding.html b/doc/html/boost_optional/dependencies_and_portability/optional_reference_binding.html index b27d9c1..fe0e2b6 100644 --- a/doc/html/boost_optional/dependencies_and_portability/optional_reference_binding.html +++ b/doc/html/boost_optional/dependencies_and_portability/optional_reference_binding.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -94,7 +94,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_optional/relnotes.html b/doc/html/boost_optional/relnotes.html new file mode 100644 index 0000000..c0dc717 --- /dev/null +++ b/doc/html/boost_optional/relnotes.html @@ -0,0 +1,119 @@ + + + +Release Notes + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

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

+ + Boost + Release 1.57 +

+
  • + Git pull #9: + "Supply <string> + to fix C++03 compile error on logic_error("...")". +
+

+ + 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 + 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 (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 (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. +
  • +
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/doc/html/index.html b/doc/html/index.html index 58b2183..d3e9ad7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -86,6 +86,7 @@
Optional Reference Binding
+
Release Notes
Acknowledgements

@@ -136,7 +137,7 @@
- +

Last revised: December 06, 2014 at 20:01:35 GMT

Last revised: January 12, 2015 at 16:12:58 GMT


diff --git a/test/optional_test_move.cpp b/test/optional_test_move.cpp index 779e0c7..51aa970 100644 --- a/test/optional_test_move.cpp +++ b/test/optional_test_move.cpp @@ -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 -#include -#include -#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 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 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 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 o1 ((Oracle())); - BOOST_CHECK(o1); - BOOST_CHECK(o1->s == sMoveConstructed); + BOOST_TEST(o1); + BOOST_TEST(o1->s == sMoveConstructed); Oracle v1; optional 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 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 o1; optional o2(boost::move(o1)); - BOOST_CHECK(!o1); - BOOST_CHECK(!o2); + BOOST_TEST(!o1); + BOOST_TEST(!o2); optional o3((Oracle())); optional 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 o5((optional())); - BOOST_CHECK(!o5); + BOOST_TEST(!o5); optional o6((optional(Oracle()))); - BOOST_CHECK(o6); - BOOST_CHECK(o6->s == sMoveConstructed); + BOOST_TEST(o6); + BOOST_TEST(o6->s == sMoveConstructed); optional o7(o6); // does copy ctor from non-const lvalue compile? } @@ -149,59 +136,59 @@ void test_move_assign_from_U() optional 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 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 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 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 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 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 o1; optional o2; o1 = optional(); - BOOST_CHECK(!o1); + BOOST_TEST(!o1); optional 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())); - 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 o1; optional o2((MoveOnly(1))); - BOOST_CHECK(o2); - BOOST_CHECK(o2->val == 1); + BOOST_TEST(o2); + BOOST_TEST(o2->val == 1); optional o3 (boost::move(o1)); - BOOST_CHECK(!o3); + BOOST_TEST(!o3); optional 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 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 a((MoveOnly(2))); optional 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 b2(( optional(( 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 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 orm = m; orm->val = 2; - BOOST_CHECK(m.val == 2); + BOOST_TEST(m.val == 2); optional 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 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(); } - -