From 4fe57f57fa52c6618e31230aac082cb61973c9c2 Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Thu, 18 May 2017 01:09:31 +0200 Subject: [PATCH] Fix make_optional for rvalues --- doc/00_optional.qbk | 2 +- doc/27_ref_optional_synopsis.qbk | 4 + doc/28_ref_optional_semantics.qbk | 18 +++ doc/html/boost_optional/acknowledgements.html | 3 +- .../dependencies_and_portability.html | 3 +- ...emplace_operations_in_older_compilers.html | 3 +- .../optional_reference_binding.html | 3 +- doc/html/boost_optional/quick_start.html | 3 +- ...sing_unnecessary_default_construction.html | 3 +- .../optional_automatic_variables.html | 3 +- .../quick_start/optional_data_members.html | 3 +- .../quick_start/storage_in_containers.html | 3 +- ...ost_optional_bad_optional_access_hpp_.html | 3 +- .../detailed_semantics.html | 3 +- .../header__boost_optional_hpp_.html | 3 +- ...der__boost_optional_optional_fwd_hpp_.html | 3 +- .../detailed_semantics___free_functions.html | 29 ++++- ...ailed_semantics___optional_references.html | 3 +- .../detailed_semantics___optional_values.html | 3 +- .../header_optional_in_place_init.html | 3 +- .../header_optional_optional_refs.html | 3 +- .../header_optional_optional_values.html | 3 +- .../boost_optional/reference/io_header.html | 3 +- .../reference/io_header/io_semantics.html | 3 +- doc/html/boost_optional/relnotes.html | 3 +- .../tutorial/design_overview.html | 3 +- .../design_overview/the_interface.html | 3 +- .../design_overview/the_semantics.html | 3 +- .../tutorial/exception_safety_guarantees.html | 3 +- doc/html/boost_optional/tutorial/gotchas.html | 3 +- ...e_positive_with__wmaybe_uninitialized.html | 3 +- .../gotchas/mixed_relational_comparisons.html | 3 +- .../gotchas/moved_from__optional_.html | 3 +- .../tutorial/in_place_factories.html | 3 +- .../boost_optional/tutorial/io_operators.html | 3 +- .../tutorial/optional_references.html | 3 +- ...for_assignment_of_optional_references.html | 3 +- .../tutorial/performance_considerations.html | 3 +- .../tutorial/relational_operators.html | 3 +- .../tutorial/type_requirements.html | 3 +- .../tutorial/when_to_use_optional.html | 3 +- doc/html/index.html | 5 +- doc/html/optional/reference.html | 3 +- .../header__boost_optional_optional_hpp_.html | 7 +- doc/html/optional/tutorial.html | 3 +- include/boost/optional/optional.hpp | 19 +++ test/Jamfile.v2 | 1 + test/optional_test_make_optional.cpp | 122 ++++++++++++++++++ 48 files changed, 280 insertions(+), 44 deletions(-) create mode 100644 test/optional_test_make_optional.cpp diff --git a/doc/00_optional.qbk b/doc/00_optional.qbk index e6ebc4c..02e21f4 100644 --- a/doc/00_optional.qbk +++ b/doc/00_optional.qbk @@ -2,7 +2,7 @@ [quickbook 1.4] [authors [Cacciola Carballal, Fernando Luis]] [copyright 2003-2007 Fernando Luis Cacciola Carballal] - [copyright 2014-2016 Andrzej Krzemieński] + [copyright 2014-2017 Andrzej Krzemieński] [category miscellaneous] [id optional] [dirname optional] diff --git a/doc/27_ref_optional_synopsis.qbk b/doc/27_ref_optional_synopsis.qbk index 2da3b8f..f93076e 100644 --- a/doc/27_ref_optional_synopsis.qbk +++ b/doc/27_ref_optional_synopsis.qbk @@ -44,8 +44,12 @@ template inline bool operator != ( optional const& x, none_t ) noexcept ; ``[link reference_operator_compare_not_equal_optional_none __GO_TO__]`` template inline optional make_optional ( T const& v ) ; ``[link reference_make_optional_value __GO_TO__]`` + + template inline optional> make_optional ( T && v ) ; ``[link reference_make_optional_rvalue __GO_TO__]`` template inline optional make_optional ( bool condition, T const& v ) ; ``[link reference_make_optional_bool_value __GO_TO__]`` + + template inline optional> make_optional ( bool condition, T && v ) ; ``[link reference_make_optional_bool_rvalue __GO_TO__]`` template inline auto get_optional_value_or ( optional const& opt, typename optional::reference_const_type def ) -> typename optional::reference_const_type; ``[link reference_free_get_value_or __GO_TO__]`` diff --git a/doc/28_ref_optional_semantics.qbk b/doc/28_ref_optional_semantics.qbk index 1288c56..7e2740c 100644 --- a/doc/28_ref_optional_semantics.qbk +++ b/doc/28_ref_optional_semantics.qbk @@ -1097,6 +1097,15 @@ template void foo ( optional const& opt ) ; foo ( make_optional(1+1) ) ; // Creates an optional `` +__SPACE__ + +[#reference_make_optional_rvalue] + +[: `optional> make_optional( T && v )`] + +* [*Returns: ] `optional>(std::move(v))` for the ['deduced] type `T` of `v`. + + __SPACE__ [#reference_make_optional_bool_value] @@ -1117,6 +1126,15 @@ if ( !v ) error("foo wasn't computed"); `` +__SPACE__ + +[#reference_make_optional_bool_rvalue] + +[: `optional> make_optional( bool condition, T && v )`] + +* [*Returns: ] `optional>(condition, std::move(v))` for the ['deduced] type `T` of `v`. + + __SPACE__ [#reference_operator_compare_equal_optional_optional] diff --git a/doc/html/boost_optional/acknowledgements.html b/doc/html/boost_optional/acknowledgements.html index 2cd116c..9d07002 100644 --- a/doc/html/boost_optional/acknowledgements.html +++ b/doc/html/boost_optional/acknowledgements.html @@ -116,7 +116,8 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
+

+ space +

+

+ optional<std::decay_t<T>> + make_optional( + T && + v ) +

+
  • + Returns: optional<std::decay_t<T>>(std::move(v)) for the deduced + type T of v. +

space

@@ -73,6 +86,19 @@ +

+ space +

+

+ optional<std::decay_t<T>> + make_optional( + bool condition, T && v + ) +

+
  • + Returns: optional<std::decay_t<T>>(condition, std::move(v)) for the deduced + type T of v. +

space

@@ -481,7 +507,8 @@ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -145,7 +146,7 @@

- +

Last revised: March 22, 2017 at 21:55:47 GMT

Last revised: May 17, 2017 at 23:01:39 GMT


diff --git a/doc/html/optional/reference.html b/doc/html/optional/reference.html index 1c9b792..fe13339 100644 --- a/doc/html/optional/reference.html +++ b/doc/html/optional/reference.html @@ -75,7 +75,8 @@ -
-
-