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 +) diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index a29137c..b5be701 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -11,6 +11,11 @@ [section:relnotes Release Notes] +[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] * 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..333178d 100644 --- a/doc/html/boost_optional/relnotes.html +++ b/doc/html/boost_optional/relnotes.html @@ -28,6 +28,21 @@

+ Boost + Release 1.73 +

+
+

+ Boost Release 1.69

@@ -45,7 +60,7 @@

- + Boost Release 1.68

@@ -62,7 +77,7 @@

- + Boost Release 1.67

@@ -76,7 +91,7 @@

- + Boost Release 1.66

@@ -94,7 +109,7 @@

- + Boost Release 1.63

@@ -118,7 +133,7 @@

- + Boost Release 1.62

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

- + Boost Release 1.61

@@ -169,7 +184,7 @@

- + Boost Release 1.60

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

- + Boost Release 1.59

@@ -194,7 +209,7 @@

- + Boost Release 1.58

@@ -230,7 +245,7 @@

- + Boost Release 1.57

@@ -240,7 +255,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..0a5611f 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:27:43 GMT


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 diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 90acd40..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 {}; @@ -967,7 +972,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) 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..f0c214a --- /dev/null +++ b/test/optional_test_path_assignment.cpp @@ -0,0 +1,69 @@ +// 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 +{ + +#if __cplusplus >= 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 + + 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 +}