From ee575b34c5531404fc09c2c9710d3c883bc314c9 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Thu, 28 Feb 2019 00:13:00 +0300 Subject: [PATCH 1/7] Fix unused argument warning boost/optional/optional.hpp:970:5: warning: unused parameter 'rhs' [-Wunused-parameter] --- include/boost/optional/optional.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 90acd40..92df93d 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -967,7 +967,7 @@ class optional // Can throw if T::T(T&&) does #ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional ( optional && rhs ) = default; + optional ( optional && ) = default; #else optional ( optional && rhs ) BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) From f4d1107e868858db331c4f5c7501921aac959440 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 18 Sep 2018 14:12:26 +0200 Subject: [PATCH 2/7] [CMake] Add minimal cmake support - CMake file only supports add_subdirectory workflow. - Provides Boost::optional target, but no installation and no unit tests --- CMakeLists.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3c836a4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright 2019 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Optional is currently experimental at best +# and the interface is likely to change in the future + +cmake_minimum_required( VERSION 3.5 ) +project( BoostOptional ) + +add_library( boost_optional INTERFACE ) +add_library( Boost::optional ALIAS boost_optional ) + +target_include_directories( boost_optional INTERFACE include ) + +target_link_libraries( boost_optional + INTERFACE + Boost::assert + Boost::config + Boost::core + Boost::detail + Boost::move + Boost::predef + Boost::static_assert + Boost::throw_exception + Boost::type_traits + Boost::utility +) From 4fbb7582e1774b1d6ef29e27b77aca3e9a3df368 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Wed, 18 Dec 2019 17:51:51 -0800 Subject: [PATCH 3/7] Don't instantiate is_convertible_to_T_or_factory when is_optional_related Fixes #78. --- include/boost/optional/optional.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 92df93d..aadc975 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -777,7 +777,7 @@ class optional_base : public optional_tag #include -// definition of metafunciton is_optional_val_init_candidate +// definition of metafunction is_optional_val_init_candidate template struct is_optional_related : boost::conditional< boost::is_base_of::type>::value @@ -813,9 +813,14 @@ struct is_optional_constructible : boost::true_type #endif // is_convertible condition -template +template ::value> struct is_optional_val_init_candidate - : boost::conditional< !is_optional_related::value && is_convertible_to_T_or_factory::value + : boost::false_type +{}; + +template +struct is_optional_val_init_candidate + : boost::conditional< is_convertible_to_T_or_factory::value , boost::true_type, boost::false_type>::type {}; From 9ed20cb0854120f76d4ccc0f9821c38553574f7e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 29 Oct 2019 21:21:03 +0300 Subject: [PATCH 4/7] Marked none instances as inline variables. This should avoid duplicating none instances in all translation units. Closes https://github.com/boostorg/optional/issues/33. --- include/boost/none.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/boost/none.hpp b/include/boost/none.hpp index a37c45c..b5df214 100644 --- a/include/boost/none.hpp +++ b/include/boost/none.hpp @@ -13,6 +13,7 @@ #ifndef BOOST_NONE_17SEP2003_HPP #define BOOST_NONE_17SEP2003_HPP +#include "boost/config.hpp" #include "boost/none_t.hpp" // NOTE: Borland users have to include this header outside any precompiled headers @@ -23,7 +24,7 @@ namespace boost { #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE -none_t const none = (static_cast(0)) ; +BOOST_INLINE_VARIABLE none_t const none = (static_cast(0)) ; #elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE @@ -35,7 +36,7 @@ namespace detail { namespace optional_detail { { static const T instance; }; - + template const T none_instance::instance = T(); // global, but because 'tis a template, no cpp file required @@ -49,7 +50,7 @@ namespace { #else -const none_t none ((none_t::init_tag())); +BOOST_INLINE_VARIABLE const none_t none ((none_t::init_tag())); #endif // older definitions From 13bc27698e96fd6a8a8191b63ae14d6a5828d1bb Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Fri, 20 Dec 2019 00:18:52 +0100 Subject: [PATCH 5/7] Add test case for fix to issue #78 --- doc/91_relnotes.qbk | 4 ++ doc/html/boost_optional/relnotes.html | 31 ++++++++----- doc/html/index.html | 2 +- test/Jamfile.v2 | 1 + test/optional_test_path_assignment.cpp | 62 ++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 12 deletions(-) create mode 100644 test/optional_test_path_assignment.cpp diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index a29137c..f19da24 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -11,6 +11,10 @@ [section:relnotes Release Notes] +[heading Boost Release 1.73] + +* Fixed [@https://github.com/boostorg/optional/issues/78 issue #78]. + [heading Boost Release 1.69] * Remove deprecation mark from `reset()` method (without arguments). diff --git a/doc/html/boost_optional/relnotes.html b/doc/html/boost_optional/relnotes.html index 3d84696..600639e 100644 --- a/doc/html/boost_optional/relnotes.html +++ b/doc/html/boost_optional/relnotes.html @@ -28,6 +28,15 @@

+ Boost + Release 1.73 +

+
+

+ Boost Release 1.69

@@ -45,7 +54,7 @@

- + Boost Release 1.68

@@ -62,7 +71,7 @@

- + Boost Release 1.67

@@ -76,7 +85,7 @@

- + Boost Release 1.66

@@ -94,7 +103,7 @@

- + Boost Release 1.63

@@ -118,7 +127,7 @@

- + Boost Release 1.62

@@ -126,7 +135,7 @@ Fixed Trac #12179.

- + Boost Release 1.61

@@ -169,7 +178,7 @@

- + Boost Release 1.60

@@ -180,7 +189,7 @@ #11203.

- + Boost Release 1.59

@@ -194,7 +203,7 @@

- + Boost Release 1.58

@@ -230,7 +239,7 @@

- + Boost Release 1.57

@@ -240,7 +249,7 @@ to fix C++03 compile error on logic_error("...")".

- + Boost Release 1.56

diff --git a/doc/html/index.html b/doc/html/index.html index 39d99e7..9094ce0 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -145,7 +145,7 @@ - +

Last revised: November 08, 2018 at 17:44:53 GMT

Last revised: December 19, 2019 at 23:07:07 GMT


diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 7936ad7..a881d52 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -50,6 +50,7 @@ import testing ; [ run optional_test_member_T.cpp ] [ run optional_test_tc_base.cpp ] [ compile optional_test_sfinae_friendly_ctor.cpp ] + [ compile optional_test_path_assignment.cpp ] [ compile-fail optional_test_fail_const_swap.cpp ] [ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ] [ compile-fail optional_test_fail1.cpp ] diff --git a/test/optional_test_path_assignment.cpp b/test/optional_test_path_assignment.cpp new file mode 100644 index 0000000..6da6718 --- /dev/null +++ b/test/optional_test_path_assignment.cpp @@ -0,0 +1,62 @@ +// Copyright (C) 2019 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 +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/lib/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com + +#include "boost/optional/optional.hpp" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +template +struct void_t +{ + typedef void type; +}; + + +template +struct trait +{ +}; + +// the following trait emulates properties std::iterator_traits +template +struct trait >::type + >::type> +{ + typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; +}; + +// This class emulates the properties of std::filesystem::path +struct Path +{ + template ::value_type> + Path(T const&); +}; + + +int main() +{ +#ifndef BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT +#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS + + boost::optional optFs1; + boost::optional optFs2; + + optFs1 = optFs2; + + // the following still fails although it shouldn't + //BOOST_STATIC_ASSERT((std::is_copy_constructible>::value)); + +#endif +#endif +} From 010ee006040c19239af9d6ae7cfab4a2ac0279c7 Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Fri, 20 Dec 2019 00:30:37 +0100 Subject: [PATCH 6/7] Update release notes --- doc/91_relnotes.qbk | 1 + doc/html/boost_optional/relnotes.html | 10 ++++++++-- doc/html/index.html | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index f19da24..b5be701 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -14,6 +14,7 @@ [heading Boost Release 1.73] * Fixed [@https://github.com/boostorg/optional/issues/78 issue #78]. +* `boost::none` is now declared as an inline variable (on compilers taht support it): there is only one instance of `boost::none` across all translation units. [heading Boost Release 1.69] diff --git a/doc/html/boost_optional/relnotes.html b/doc/html/boost_optional/relnotes.html index 600639e..333178d 100644 --- a/doc/html/boost_optional/relnotes.html +++ b/doc/html/boost_optional/relnotes.html @@ -31,10 +31,16 @@ Boost Release 1.73 -
  • +
    +
  • +
  • + boost::none is now declared as an inline variable + (on compilers taht support it): there is only one instance of boost::none across all translation units. +
  • +

Boost diff --git a/doc/html/index.html b/doc/html/index.html index 9094ce0..0a5611f 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -145,7 +145,7 @@ - +

Last revised: December 19, 2019 at 23:07:07 GMT

Last revised: December 19, 2019 at 23:27:43 GMT


From d4a4a5b6ad6c69c28666731beddc7d8aa480b334 Mon Sep 17 00:00:00 2001 From: Andrzej Krzemienski Date: Thu, 16 Jan 2020 22:31:23 +0100 Subject: [PATCH 7/7] fixed C++98-incompatible unit test --- test/optional_test_path_assignment.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/optional_test_path_assignment.cpp b/test/optional_test_path_assignment.cpp index 6da6718..f0c214a 100644 --- a/test/optional_test_path_assignment.cpp +++ b/test/optional_test_path_assignment.cpp @@ -20,7 +20,7 @@ struct void_t { typedef void type; }; - + template struct trait @@ -29,7 +29,7 @@ struct trait // the following trait emulates properties std::iterator_traits template -struct trait >::type >::type> { @@ -39,13 +39,20 @@ struct trait= 201103 template ::value_type> Path(T const&); +#else + template + Path(T const&, BOOST_DEDUCED_TYPENAME trait::value_type* = 0); +#endif + }; int main() -{ +{ #ifndef BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT #ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS