summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-contrib <[email protected]>2024-12-17 07:20:57 +0300
committerrobot-contrib <[email protected]>2024-12-17 07:35:51 +0300
commit78fef26a7b6240b545800b449a3a88a5c2ab8477 (patch)
treed40e3446492e1f219eda3e6eebb626243670e607
parent5a9022e45221b12be2fb71480dbfe0d0fa1f856c (diff)
Update contrib/restricted/boost/optional to 1.87.0
commit_hash:f1e4a6495ec720d31dacd477df0aafef02ebf576
-rw-r--r--contrib/restricted/boost/optional/.yandex_meta/devtools.copyrights.report46
-rw-r--r--contrib/restricted/boost/optional/.yandex_meta/devtools.licenses.report17
-rw-r--r--contrib/restricted/boost/optional/.yandex_meta/licenses.list.txt17
-rw-r--r--contrib/restricted/boost/optional/include/boost/none.hpp2
-rw-r--r--contrib/restricted/boost/optional/include/boost/none_t.hpp14
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/experimental_traits.hpp53
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/old_optional_implementation.hpp1059
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_aligned_storage.hpp5
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_config.hpp17
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_reference_spec.hpp93
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_relops.hpp22
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_swap.hpp6
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_trivially_copyable_base.hpp264
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/detail/optional_utility.hpp41
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/optional.hpp693
-rw-r--r--contrib/restricted/boost/optional/include/boost/optional/optional_io.hpp6
-rw-r--r--contrib/restricted/boost/optional/ya.make9
17 files changed, 296 insertions, 2068 deletions
diff --git a/contrib/restricted/boost/optional/.yandex_meta/devtools.copyrights.report b/contrib/restricted/boost/optional/.yandex_meta/devtools.copyrights.report
index 3763783f153..0335f9f3778 100644
--- a/contrib/restricted/boost/optional/.yandex_meta/devtools.copyrights.report
+++ b/contrib/restricted/boost/optional/.yandex_meta/devtools.copyrights.report
@@ -81,7 +81,17 @@ BELONGS ya.make
Match type : COPYRIGHT
Files with this license:
include/boost/none.hpp [1:2]
- include/boost/none_t.hpp [1:2]
+
+KEEP COPYRIGHT_SERVICE_LABEL 49502cfd99d9b7c0c64b960a8260c6e9
+BELONGS ya.make
+ License text:
+ // Copyright (C) 2024 Ryan Malcolm Underwood.
+ Scancode info:
+ Original SPDX id: COPYRIGHT_SERVICE_LABEL
+ Score : 100.00
+ Match type : COPYRIGHT
+ Files with this license:
+ include/boost/optional/detail/optional_utility.hpp [1:1]
KEEP COPYRIGHT_SERVICE_LABEL 75f254658639d6099b8a2607570e97af
BELONGS ya.make
@@ -93,7 +103,6 @@ BELONGS ya.make
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- include/boost/optional/detail/old_optional_implementation.hpp [1:2]
include/boost/optional/detail/optional_aligned_storage.hpp [1:2]
include/boost/optional/detail/optional_config.hpp [1:2]
include/boost/optional/detail/optional_factory_support.hpp [1:2]
@@ -102,16 +111,17 @@ BELONGS ya.make
include/boost/optional/optional.hpp [1:2]
include/boost/optional/optional_fwd.hpp [1:2]
-KEEP COPYRIGHT_SERVICE_LABEL 915672e3644591e88da568c16864a106
+KEEP COPYRIGHT_SERVICE_LABEL 9011a14a0693638672595b3219eab47e
BELONGS ya.make
License text:
- // Copyright (C) 2015-2018 Andrzej Krzemienski.
+ // Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
+ // Copyright (C) 2015, 2024 Andrzej Krzemienski.
Scancode info:
Original SPDX id: COPYRIGHT_SERVICE_LABEL
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- include/boost/optional/detail/optional_reference_spec.hpp [1:1]
+ include/boost/optional/detail/optional_relops.hpp [1:2]
KEEP COPYRIGHT_SERVICE_LABEL 97a90988e6e57fde8f8f24870992405e
BELONGS ya.make
@@ -150,30 +160,29 @@ BELONGS ya.make
include/boost/none_t.hpp [1:2]
include/boost/optional.hpp [1:1]
-KEEP COPYRIGHT_SERVICE_LABEL bda851fc939db851e4440dc9806f0d16
+KEEP COPYRIGHT_SERVICE_LABEL c8d4e667a2b45ad481c6365ab8ff146a
BELONGS ya.make
License text:
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
- // Copyright (C) 2014-2016 Andrzej Krzemienski.
+ // Copyright (C) 2015 Andrzej Krzemienski.
Scancode info:
Original SPDX id: COPYRIGHT_SERVICE_LABEL
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- include/boost/optional/detail/old_optional_implementation.hpp [1:2]
+ include/boost/optional/detail/optional_swap.hpp [1:2]
-KEEP COPYRIGHT_SERVICE_LABEL c8d4e667a2b45ad481c6365ab8ff146a
+KEEP COPYRIGHT_SERVICE_LABEL db3e30044d1f01643d8ed0bc550521ef
BELONGS ya.make
License text:
- // Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
- // Copyright (C) 2015 Andrzej Krzemienski.
+ // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
+ // Copyright (C) 2014, 2024 Andrzej Krzemienski.
Scancode info:
Original SPDX id: COPYRIGHT_SERVICE_LABEL
Score : 100.00
Match type : COPYRIGHT
Files with this license:
- include/boost/optional/detail/optional_relops.hpp [1:2]
- include/boost/optional/detail/optional_swap.hpp [1:2]
+ include/boost/none_t.hpp [1:2]
KEEP COPYRIGHT_SERVICE_LABEL db7c109214a40b15282917536ab96515
BELONGS ya.make
@@ -197,3 +206,14 @@ BELONGS ya.make
Match type : COPYRIGHT
Files with this license:
include/boost/optional/optional_io.hpp [1:1]
+
+KEEP COPYRIGHT_SERVICE_LABEL fe0444c22ecc3ff736a4eefe9c896df5
+BELONGS ya.make
+ License text:
+ // Copyright (C) 2015-2024 Andrzej Krzemienski.
+ Scancode info:
+ Original SPDX id: COPYRIGHT_SERVICE_LABEL
+ Score : 100.00
+ Match type : COPYRIGHT
+ Files with this license:
+ include/boost/optional/detail/optional_reference_spec.hpp [1:1]
diff --git a/contrib/restricted/boost/optional/.yandex_meta/devtools.licenses.report b/contrib/restricted/boost/optional/.yandex_meta/devtools.licenses.report
index def814b5216..0577879981a 100644
--- a/contrib/restricted/boost/optional/.yandex_meta/devtools.licenses.report
+++ b/contrib/restricted/boost/optional/.yandex_meta/devtools.licenses.report
@@ -59,10 +59,10 @@ BELONGS ya.make
Match type : NOTICE
Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0
Files with this license:
+ include/boost/none_t.hpp [4:6]
include/boost/optional.hpp [3:5]
include/boost/optional/bad_optional_access.hpp [3:5]
include/boost/optional/detail/experimental_traits.hpp [3:5]
- include/boost/optional/detail/old_optional_implementation.hpp [4:6]
include/boost/optional/detail/optional_aligned_storage.hpp [4:6]
include/boost/optional/detail/optional_config.hpp [4:6]
include/boost/optional/detail/optional_factory_support.hpp [4:6]
@@ -71,20 +71,7 @@ BELONGS ya.make
include/boost/optional/detail/optional_relops.hpp [4:6]
include/boost/optional/detail/optional_swap.hpp [4:6]
include/boost/optional/detail/optional_trivially_copyable_base.hpp [3:5]
+ include/boost/optional/detail/optional_utility.hpp [3:5]
include/boost/optional/optional.hpp [4:6]
include/boost/optional/optional_fwd.hpp [4:6]
include/boost/optional/optional_io.hpp [3:5]
-
-KEEP BSL-1.0 dfcb4a59104a0c22bf3eb471b928b116
-BELONGS ya.make
- License text:
- // 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)
- Scancode info:
- Original SPDX id: BSL-1.0
- Score : 96.88
- Match type : NOTICE
- Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0
- Files with this license:
- include/boost/none_t.hpp [4:6]
diff --git a/contrib/restricted/boost/optional/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/optional/.yandex_meta/licenses.list.txt
index 3806a3555ca..149038e0caa 100644
--- a/contrib/restricted/boost/optional/.yandex_meta/licenses.list.txt
+++ b/contrib/restricted/boost/optional/.yandex_meta/licenses.list.txt
@@ -17,17 +17,17 @@
====================COPYRIGHT====================
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
-// Copyright (C) 2014-2016 Andrzej Krzemienski.
+// Copyright (C) 2015 - 2017 Andrzej Krzemienski.
====================COPYRIGHT====================
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
-// Copyright (C) 2015 - 2017 Andrzej Krzemienski.
+// Copyright (C) 2015 Andrzej Krzemienski.
====================COPYRIGHT====================
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
-// Copyright (C) 2015 Andrzej Krzemienski.
+// Copyright (C) 2015, 2024 Andrzej Krzemienski.
====================COPYRIGHT====================
@@ -41,6 +41,11 @@
====================COPYRIGHT====================
+// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
+// Copyright (C) 2014, 2024 Andrzej Krzemienski.
+
+
+====================COPYRIGHT====================
// Copyright (C) 2005, Fernando Luis Cacciola Carballal.
@@ -49,7 +54,7 @@
====================COPYRIGHT====================
-// Copyright (C) 2015-2018 Andrzej Krzemienski.
+// Copyright (C) 2015-2024 Andrzej Krzemienski.
====================COPYRIGHT====================
@@ -58,3 +63,7 @@
====================COPYRIGHT====================
// Copyright (C) 2022 Andrzej Krzemienski.
+
+
+====================COPYRIGHT====================
+// Copyright (C) 2024 Ryan Malcolm Underwood.
diff --git a/contrib/restricted/boost/optional/include/boost/none.hpp b/contrib/restricted/boost/optional/include/boost/none.hpp
index 5f927cc36b8..3e7a9500552 100644
--- a/contrib/restricted/boost/optional/include/boost/none.hpp
+++ b/contrib/restricted/boost/optional/include/boost/none.hpp
@@ -50,7 +50,7 @@ namespace {
#else
-BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST none_t none ((none_t::init_tag()));
+BOOST_INLINE_CONSTEXPR none_t none ((none_t::init_tag()));
#endif // older definitions
diff --git a/contrib/restricted/boost/optional/include/boost/none_t.hpp b/contrib/restricted/boost/optional/include/boost/none_t.hpp
index 419a7286604..1c8e07611e4 100644
--- a/contrib/restricted/boost/optional/include/boost/none_t.hpp
+++ b/contrib/restricted/boost/optional/include/boost/none_t.hpp
@@ -1,5 +1,5 @@
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
-// Copyright (C) 2014, 2015 Andrzej Krzemienski.
+// Copyright (C) 2014, 2024 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
@@ -16,10 +16,16 @@
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
-#if defined (BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_REF_QUALIFIERS) \
-|| defined(BOOST_NO_CXX11_LAMBDAS) || defined(BOOST_NO_CXX11_DECLTYPE_N3276) || defined(BOOST_NO_CXX11_NOEXCEPT) || defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_DEFAULTED_MOVES) || defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
+#if defined (BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \
+|| defined(BOOST_NO_CXX11_LAMBDAS) || defined(BOOST_NO_CXX11_DECLTYPE_N3276) \
+|| defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \
+|| defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) || defined(BOOST_NO_CXX11_STATIC_ASSERT)
-BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Optional 1.83 and will be removed in Boost.Optional 1.86.")
+#error "Boost.Optional requires some C++11 features since version 1.87. If you have an older C++ version use Boost.Optional version 1.86 or earlier."
+
+#elif defined(BOOST_NO_CXX11_REF_QUALIFIERS) || defined(BOOST_NO_CXX11_NOEXCEPT) || defined(BOOST_NO_CXX11_DEFAULTED_MOVES)
+
+BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Optional 1.83 and will be removed in Boost.Optional 1.88.")
#endif
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/experimental_traits.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/experimental_traits.hpp
index b51f5f10449..4d4abe8b778 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/experimental_traits.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/experimental_traits.hpp
@@ -12,19 +12,14 @@
#ifndef BOOST_OPTIONAL_DETAIL_EXPERIMENTAL_TRAITS_04NOV2017_HPP
#define BOOST_OPTIONAL_DETAIL_EXPERIMENTAL_TRAITS_04NOV2017_HPP
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/predef.h>
#include <boost/type_traits.hpp>
-
+
// The condition to use POD implementation
#ifdef BOOST_OPTIONAL_CONFIG_NO_POD_SPEC
# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
#elif defined BOOST_OPTIONAL_CONFIG_NO_SPEC_FOR_TRIVIAL_TYPES
# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
-#elif !defined BOOST_HAS_TRIVIAL_CONSTRUCTOR
-# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
#elif !defined BOOST_HAS_TRIVIAL_MOVE_ASSIGN
# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
#elif !defined BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR
@@ -35,37 +30,14 @@
# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
#elif !defined BOOST_HAS_TRIVIAL_DESTRUCTOR
# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
-#elif BOOST_WORKAROUND(BOOST_GCC, < 50000)
-# define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
#endif
-// GCC 5 or higher, or clang with libc++ or clang with libstdc++ 5 or higher
-#if __cplusplus >= 201103L
-# if BOOST_WORKAROUND(BOOST_GCC, >= 50000)
-# define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
-# elif (defined BOOST_CLANG)
-# if BOOST_LIB_STD_CXX > 0
-# define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
-# elif BOOST_LIB_STD_GNU >= 441200023 && BOOST_LIB_STD_GNU != 450600023 && BOOST_LIB_STD_GNU != 450600026 && BOOST_LIB_STD_GNU != 460800003 && BOOST_LIB_STD_GNU != 450400026 && BOOST_LIB_STD_GNU != 460700026
-# define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
-# endif
-# endif
-#endif
-
-#ifndef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
-# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
-#else
-# include <type_traits>
-# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) std::is_trivially_default_constructible<T>::value
-#endif
-
-
namespace boost { namespace optional_detail {
-
+
#ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
template <typename T>
-struct is_type_trivially_copyable
+struct is_trivially_semiregular
: boost::conditional<(boost::has_trivial_copy_constructor<T>::value &&
boost::has_trivial_move_constructor<T>::value &&
boost::has_trivial_destructor<T>::value &&
@@ -75,30 +47,13 @@ struct is_type_trivially_copyable
{};
#else
template <typename T>
-struct is_type_trivially_copyable
+struct is_trivially_semiregular
: boost::conditional<(boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value),
boost::true_type, boost::false_type>::type
{};
#endif
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
-template <typename T>
-struct optional_uses_direct_storage_for_
- : boost::conditional< (is_type_trivially_copyable<T>::value && BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T)) ||
- (boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value)
- , boost::true_type, boost::false_type>::type
-{};
-#else
-template <typename T>
-struct optional_uses_direct_storage_for_
- : boost::conditional<(boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value)
- , boost::true_type, boost::false_type>::type
-{};
-#endif
-
-
}} // boost::optional_detail
#endif
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/old_optional_implementation.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/old_optional_implementation.hpp
deleted file mode 100644
index 75d4bdcf1d7..00000000000
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/old_optional_implementation.hpp
+++ /dev/null
@@ -1,1059 +0,0 @@
-// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
-// Copyright (C) 2014-2016 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/libs/optional for documentation.
-//
-// You are welcome to contact the maintainer at:
-
-#ifndef BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP
-#define BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP
-
-#include <boost/detail/reference_content.hpp>
-#include <boost/type_traits/is_reference.hpp>
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/conditional.hpp>
-#include <boost/core/invoke_swap.hpp>
-
-namespace boost {
-
-namespace optional_detail {
-
-
-template<class T>
-struct types_when_isnt_ref
-{
- typedef T const& reference_const_type ;
- typedef T & reference_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- typedef T && rval_reference_type ;
- typedef T && reference_type_of_temporary_wrapper;
-#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
- // GCC 4.4 has support for an early draft of rvalue references. The conforming version below
- // causes warnings about returning references to a temporary.
- static T&& move(T&& r) { return r; }
-#else
- static rval_reference_type move(reference_type r) { return boost::move(r); }
-#endif
-#endif
- typedef T const* pointer_const_type ;
- typedef T * pointer_type ;
- typedef T const& argument_type ;
-} ;
-
-template<class T>
-struct types_when_is_ref
-{
- typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type raw_type ;
-
- typedef raw_type& reference_const_type ;
- typedef raw_type& reference_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- typedef BOOST_DEDUCED_TYPENAME remove_const<raw_type>::type&& rval_reference_type ;
- typedef raw_type& reference_type_of_temporary_wrapper;
- static reference_type move(reference_type r) { return r; }
-#endif
- typedef raw_type* pointer_const_type ;
- typedef raw_type* pointer_type ;
- typedef raw_type& argument_type ;
-} ;
-
-template <class To, class From>
-void prevent_binding_rvalue_ref_to_optional_lvalue_ref()
-{
-#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES
- BOOST_STATIC_ASSERT_MSG(
- !boost::is_lvalue_reference<To>::value || !boost::is_rvalue_reference<From>::value,
- "binding rvalue references to optional lvalue references is disallowed");
-#endif
-}
-
-struct optional_tag {} ;
-
-template<class T>
-class optional_base : public optional_tag
-{
- private :
-
- typedef
-#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
- BOOST_DEDUCED_TYPENAME
-#endif
- ::boost::detail::make_reference_content<T>::type internal_type ;
-
- typedef aligned_storage<internal_type> storage_type ;
-
- typedef types_when_isnt_ref<T> types_when_not_ref ;
- typedef types_when_is_ref<T> types_when_ref ;
-
- typedef optional_base<T> this_type ;
-
- protected :
-
- typedef T value_type ;
-
- typedef true_type is_reference_tag ;
- typedef false_type is_not_reference_tag ;
-
- typedef BOOST_DEDUCED_TYPENAME is_reference<T>::type is_reference_predicate ;
-
- public:
- typedef BOOST_DEDUCED_TYPENAME conditional<is_reference_predicate::value,types_when_ref,types_when_not_ref>::type types ;
-
- protected:
- typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ;
- typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- typedef BOOST_DEDUCED_TYPENAME types::rval_reference_type rval_reference_type ;
- typedef BOOST_DEDUCED_TYPENAME types::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ;
-#endif
- typedef BOOST_DEDUCED_TYPENAME types::pointer_type pointer_type ;
- typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type pointer_const_type ;
- typedef BOOST_DEDUCED_TYPENAME types::argument_type argument_type ;
-
- // Creates an optional<T> uninitialized.
- // No-throw
- optional_base()
- :
- m_initialized(false) {}
-
- // Creates an optional<T> uninitialized.
- // No-throw
- optional_base ( none_t )
- :
- m_initialized(false) {}
-
- // Creates an optional<T> initialized with 'val'.
- // Can throw if T::T(T const&) does
- optional_base ( argument_type val )
- :
- m_initialized(false)
- {
- construct(val);
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // move-construct an optional<T> initialized from an rvalue-ref to 'val'.
- // Can throw if T::T(T&&) does
- optional_base ( rval_reference_type val )
- :
- m_initialized(false)
- {
- construct( boost::move(val) );
- }
-#endif
-
- // Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional<T>.
- // Can throw if T::T(T const&) does
- optional_base ( bool cond, argument_type val )
- :
- m_initialized(false)
- {
- if ( cond )
- construct(val);
- }
-
- // Creates a deep copy of another optional<T>
- // Can throw if T::T(T const&) does
- optional_base ( optional_base const& rhs )
- :
- m_initialized(false)
- {
- if ( rhs.is_initialized() )
- construct(rhs.get_impl());
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Creates a deep move of another optional<T>
- // Can throw if T::T(T&&) does
- optional_base ( optional_base&& rhs )
- :
- m_initialized(false)
- {
- if ( rhs.is_initialized() )
- construct( boost::move(rhs.get_impl()) );
- }
-#endif
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
- template<class Expr, class PtrExpr>
- explicit optional_base ( Expr&& expr, PtrExpr const* tag )
- :
- m_initialized(false)
- {
- construct(boost::forward<Expr>(expr),tag);
- }
-
-#else
- // This is used for both converting and in-place constructions.
- // Derived classes use the 'tag' to select the appropriate
- // implementation (the correct 'construct()' overload)
- template<class Expr>
- explicit optional_base ( Expr const& expr, Expr const* tag )
- :
- m_initialized(false)
- {
- construct(expr,tag);
- }
-
-#endif
-
-
- // No-throw (assuming T::~T() doesn't)
- ~optional_base() { destroy() ; }
-
- // Assigns from another optional<T> (deep-copies the rhs value)
- void assign ( optional_base const& rhs )
- {
- if (is_initialized())
- {
- if ( rhs.is_initialized() )
- assign_value(rhs.get_impl(), is_reference_predicate() );
- else destroy();
- }
- else
- {
- if ( rhs.is_initialized() )
- construct(rhs.get_impl());
- }
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Assigns from another optional<T> (deep-moves the rhs value)
- void assign ( optional_base&& rhs )
- {
- if (is_initialized())
- {
- if ( rhs.is_initialized() )
- assign_value(boost::move(rhs.get_impl()), is_reference_predicate() );
- else destroy();
- }
- else
- {
- if ( rhs.is_initialized() )
- construct(boost::move(rhs.get_impl()));
- }
- }
-#endif
-
- // Assigns from another _convertible_ optional<U> (deep-copies the rhs value)
- template<class U>
- void assign ( optional<U> const& rhs )
- {
- if (is_initialized())
- {
- if ( rhs.is_initialized() )
-#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES
- assign_value(rhs.get(), is_reference_predicate() );
-#else
- assign_value(static_cast<value_type>(rhs.get()), is_reference_predicate() );
-#endif
-
- else destroy();
- }
- else
- {
- if ( rhs.is_initialized() )
-#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES
- construct(rhs.get());
-#else
- construct(static_cast<value_type>(rhs.get()));
-#endif
- }
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // move-assigns from another _convertible_ optional<U> (deep-moves from the rhs value)
- template<class U>
- void assign ( optional<U>&& rhs )
- {
- typedef BOOST_DEDUCED_TYPENAME optional<U>::rval_reference_type ref_type;
- if (is_initialized())
- {
- if ( rhs.is_initialized() )
- assign_value(static_cast<ref_type>(rhs.get()), is_reference_predicate() );
- else destroy();
- }
- else
- {
- if ( rhs.is_initialized() )
- construct(static_cast<ref_type>(rhs.get()));
- }
- }
-#endif
-
- // Assigns from a T (deep-copies the rhs value)
- void assign ( argument_type val )
- {
- if (is_initialized())
- assign_value(val, is_reference_predicate() );
- else construct(val);
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Assigns from a T (deep-moves the rhs value)
- void assign ( rval_reference_type val )
- {
- if (is_initialized())
- assign_value( boost::move(val), is_reference_predicate() );
- else construct( boost::move(val) );
- }
-#endif
-
- // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED
- // No-throw (assuming T::~T() doesn't)
- void assign ( none_t ) BOOST_NOEXCEPT { destroy(); }
-
-#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- template<class Expr, class ExprPtr>
- void assign_expr ( Expr&& expr, ExprPtr const* tag )
- {
- if (is_initialized())
- assign_expr_to_initialized(boost::forward<Expr>(expr),tag);
- else construct(boost::forward<Expr>(expr),tag);
- }
-#else
- template<class Expr>
- void assign_expr ( Expr const& expr, Expr const* tag )
- {
- if (is_initialized())
- assign_expr_to_initialized(expr,tag);
- else construct(expr,tag);
- }
-#endif
-
-#endif
-
- public :
-
- // Destroys the current value, if any, leaving this UNINITIALIZED
- // No-throw (assuming T::~T() doesn't)
- void reset() BOOST_NOEXCEPT { destroy(); }
-
- // **DEPRECATED** Replaces the current value -if any- with 'val'
- void reset ( argument_type val ) { assign(val); }
-
- // Returns a pointer to the value if this is initialized, otherwise,
- // returns NULL.
- // No-throw
- pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; }
- pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; }
-
- bool is_initialized() const { return m_initialized ; }
-
- protected :
-
- void construct ( argument_type val )
- {
- ::new (m_storage.address()) internal_type(val) ;
- m_initialized = true ;
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- void construct ( rval_reference_type val )
- {
- ::new (m_storage.address()) internal_type( types::move(val) ) ;
- m_initialized = true ;
- }
-#endif
-
-
-#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- // Constructs in-place
- // upon exception *this is always uninitialized
- template<class... Args>
- void emplace_assign ( Args&&... args )
- {
- destroy();
- ::new (m_storage.address()) internal_type( boost::forward<Args>(args)... );
- m_initialized = true ;
- }
-#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template<class Arg>
- void emplace_assign ( Arg&& arg )
- {
- destroy();
- ::new (m_storage.address()) internal_type( boost::forward<Arg>(arg) );
- m_initialized = true ;
- }
-
- void emplace_assign ()
- {
- destroy();
- ::new (m_storage.address()) internal_type();
- m_initialized = true ;
- }
-#else
- template<class Arg>
- void emplace_assign ( const Arg& arg )
- {
- destroy();
- ::new (m_storage.address()) internal_type( arg );
- m_initialized = true ;
- }
-
- template<class Arg>
- void emplace_assign ( Arg& arg )
- {
- destroy();
- ::new (m_storage.address()) internal_type( arg );
- m_initialized = true ;
- }
-
- void emplace_assign ()
- {
- destroy();
- ::new (m_storage.address()) internal_type();
- m_initialized = true ;
- }
-#endif
-
-#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Constructs in-place using the given factory
- template<class Expr>
- void construct ( Expr&& factory, in_place_factory_base const* )
- {
- BOOST_STATIC_ASSERT ( !is_reference_predicate::value ) ;
- boost_optional_detail::construct<value_type>(factory, m_storage.address());
- m_initialized = true ;
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void construct ( Expr&& factory, typed_in_place_factory_base const* )
- {
- BOOST_STATIC_ASSERT ( !is_reference_predicate::value ) ;
- factory.apply(m_storage.address()) ;
- m_initialized = true ;
- }
-
- template<class Expr>
- void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-
-#else
- // Constructs in-place using the given factory
- template<class Expr>
- void construct ( Expr const& factory, in_place_factory_base const* )
- {
- BOOST_STATIC_ASSERT ( !is_reference_predicate::value ) ;
- boost_optional_detail::construct<value_type>(factory, m_storage.address());
- m_initialized = true ;
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void construct ( Expr const& factory, typed_in_place_factory_base const* )
- {
- BOOST_STATIC_ASSERT ( !is_reference_predicate::value ) ;
- factory.apply(m_storage.address()) ;
- m_initialized = true ;
- }
-
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-#endif
-
-#endif
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Constructs using any expression implicitly convertible to the single argument
- // of a one-argument T constructor.
- // Converting constructions of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
- template<class Expr>
- void construct ( Expr&& expr, void const* )
- {
- new (m_storage.address()) internal_type(boost::forward<Expr>(expr)) ;
- m_initialized = true ;
- }
-
- // Assigns using a form any expression implicitly convertible to the single argument
- // of a T's assignment operator.
- // Converting assignments of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
- template<class Expr>
- void assign_expr_to_initialized ( Expr&& expr, void const* )
- {
- assign_value(boost::forward<Expr>(expr), is_reference_predicate());
- }
-#else
- // Constructs using any expression implicitly convertible to the single argument
- // of a one-argument T constructor.
- // Converting constructions of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
- template<class Expr>
- void construct ( Expr const& expr, void const* )
- {
- new (m_storage.address()) internal_type(expr) ;
- m_initialized = true ;
- }
-
- // Assigns using a form any expression implicitly convertible to the single argument
- // of a T's assignment operator.
- // Converting assignments of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& expr, void const* )
- {
- assign_value(expr, is_reference_predicate());
- }
-
-#endif
-
-#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
- // BCB5.64 (and probably lower versions) workaround.
- // The in-place factories are supported by means of catch-all constructors
- // and assignment operators (the functions are parameterized in terms of
- // an arbitrary 'Expr' type)
- // This compiler incorrectly resolves the overload set and sinks optional<T> and optional<U>
- // to the 'Expr'-taking functions even though explicit overloads are present for them.
- // Thus, the following overload is needed to properly handle the case when the 'lhs'
- // is another optional.
- //
- // For VC<=70 compilers this workaround doesn't work because the compiler issues and error
- // instead of choosing the wrong overload
- //
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Notice that 'Expr' will be optional<T> or optional<U> (but not optional_base<..>)
- template<class Expr>
- void construct ( Expr&& expr, optional_tag const* )
- {
- if ( expr.is_initialized() )
- {
- // An exception can be thrown here.
- // It it happens, THIS will be left uninitialized.
- new (m_storage.address()) internal_type(types::move(expr.get())) ;
- m_initialized = true ;
- }
- }
-#else
- // Notice that 'Expr' will be optional<T> or optional<U> (but not optional_base<..>)
- template<class Expr>
- void construct ( Expr const& expr, optional_tag const* )
- {
- if ( expr.is_initialized() )
- {
- // An exception can be thrown here.
- // It it happens, THIS will be left uninitialized.
- new (m_storage.address()) internal_type(expr.get()) ;
- m_initialized = true ;
- }
- }
-#endif
-#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
-
- void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; }
- void assign_value ( argument_type val, is_reference_tag ) { construct(val); }
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- void assign_value ( rval_reference_type val, is_not_reference_tag ) { get_impl() = static_cast<rval_reference_type>(val); }
- void assign_value ( rval_reference_type val, is_reference_tag ) { construct( static_cast<rval_reference_type>(val) ); }
-#endif
-
- void destroy()
- {
- if ( m_initialized )
- destroy_impl(is_reference_predicate()) ;
- }
-
- reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; }
- reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; }
-
- pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; }
- pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; }
-
- private :
-
- // internal_type can be either T or reference_content<T>
-#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
- // This workaround is supposed to silence GCC warnings about broken strict aliasing rules
- internal_type const* get_object() const
- {
- union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() };
- return caster.as_ptype;
- }
- internal_type * get_object()
- {
- union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() };
- return caster.as_ptype;
- }
-#else
- internal_type const* get_object() const { return static_cast<internal_type const*>(m_storage.address()); }
- internal_type * get_object() { return static_cast<internal_type *> (m_storage.address()); }
-#endif
-
- // reference_content<T> lacks an implicit conversion to T&, so the following is needed to obtain a proper reference.
- reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; }
- reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; }
- reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; }
- reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; }
-
-#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
- void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; }
-#else
- void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; }
-#endif
-
- void destroy_impl ( is_reference_tag ) { m_initialized = false ; }
-
- // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error.
- // Decent compilers should disallow conversions from reference_content<T>* to T*, but just in case,
- // the following overloads are used to filter out the case and guarantee an error in case of T being a reference.
- pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; }
- pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; }
- pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; }
- pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; }
-
- bool m_initialized ;
- storage_type m_storage ;
-} ;
-
-} // namespace optional_detail
-
-template<class T>
-class optional : public optional_detail::optional_base<T>
-{
- typedef optional_detail::optional_base<T> base ;
-
- public :
-
- typedef optional<T> this_type ;
-
- typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ;
- typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ;
- typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ;
- typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ;
-#endif
- typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ;
- typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ;
- typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ;
-
- // Creates an optional<T> uninitialized.
- // No-throw
- optional() BOOST_NOEXCEPT : base() {}
-
- // Creates an optional<T> uninitialized.
- // No-throw
- optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {}
-
- // Creates an optional<T> initialized with 'val'.
- // Can throw if T::T(T const&) does
- optional ( argument_type val ) : base(val) {}
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Creates an optional<T> initialized with 'move(val)'.
- // Can throw if T::T(T &&) does
- optional ( rval_reference_type val ) : base( boost::forward<T>(val) )
- {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref<T, rval_reference_type>();}
-#endif
-
- // Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional.
- // Can throw if T::T(T const&) does
- optional ( bool cond, argument_type val ) : base(cond,val) {}
-
- // NOTE: MSVC needs templated versions first
-
- // Creates a deep copy of another convertible optional<U>
- // Requires a valid conversion from U to T.
- // Can throw if T::T(U const&) does
- template<class U>
- explicit optional ( optional<U> const& rhs )
- :
- base()
- {
- if ( rhs.is_initialized() )
- this->construct(rhs.get());
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Creates a deep move of another convertible optional<U>
- // Requires a valid conversion from U to T.
- // Can throw if T::T(U&&) does
- template<class U>
- explicit optional ( optional<U> && rhs )
- :
- base()
- {
- if ( rhs.is_initialized() )
- this->construct( boost::move(rhs.get()) );
- }
-#endif
-
-#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
- // Creates an optional<T> with an expression which can be either
- // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n);
- // (b) An instance of TypedInPlaceFactory ( i.e. in_place<T>(a,b,...,n);
- // (c) Any expression implicitly convertible to the single type
- // of a one-argument T's constructor.
- // (d*) Weak compilers (BCB) might also resolved Expr as optional<T> and optional<U>
- // even though explicit overloads are present for these.
- // Depending on the above some T ctor is called.
- // Can throw if the resolved T ctor throws.
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
-
- template<class Expr>
- explicit optional ( Expr&& expr,
- BOOST_DEDUCED_TYPENAME boost::disable_if_c<
- (boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<Expr>::type>::value) ||
- boost::is_same<BOOST_DEDUCED_TYPENAME boost::decay<Expr>::type, none_t>::value, bool >::type = true
- )
- : base(boost::forward<Expr>(expr),boost::addressof(expr))
- {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref<T, Expr&&>();}
-
-#else
- template<class Expr>
- explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {}
-#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-
- // Creates a deep copy of another optional<T>
- // Can throw if T::T(T const&) does
- optional ( optional const& rhs ) : base( static_cast<base const&>(rhs) ) {}
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Creates a deep move of another optional<T>
- // Can throw if T::T(T&&) does
- optional ( optional && rhs )
- BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value)
- : base( boost::move(rhs) )
- {}
-
-#endif
- // No-throw (assuming T::~T() doesn't)
- ~optional() {}
-
-#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
- // Assigns from an expression. See corresponding constructor.
- // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
- template<class Expr>
- BOOST_DEDUCED_TYPENAME boost::disable_if_c<
- boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<Expr>::type>::value ||
- boost::is_same<BOOST_DEDUCED_TYPENAME boost::decay<Expr>::type, none_t>::value,
- optional&
- >::type
- operator= ( Expr&& expr )
- {
- optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref<T, Expr&&>();
- this->assign_expr(boost::forward<Expr>(expr),boost::addressof(expr));
- return *this ;
- }
-
-#else
- template<class Expr>
- optional& operator= ( Expr const& expr )
- {
- this->assign_expr(expr,boost::addressof(expr));
- return *this ;
- }
-#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
-
- // Copy-assigns from another convertible optional<U> (converts && deep-copies the rhs value)
- // Requires a valid conversion from U to T.
- // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED
- template<class U>
- optional& operator= ( optional<U> const& rhs )
- {
- this->assign(rhs);
- return *this ;
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Move-assigns from another convertible optional<U> (converts && deep-moves the rhs value)
- // Requires a valid conversion from U to T.
- // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED
- template<class U>
- optional& operator= ( optional<U> && rhs )
- {
- this->assign(boost::move(rhs));
- return *this ;
- }
-#endif
-
- // Assigns from another optional<T> (deep-copies the rhs value)
- // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED
- // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw)
- optional& operator= ( optional const& rhs )
- {
- this->assign( static_cast<base const&>(rhs) ) ;
- return *this ;
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Assigns from another optional<T> (deep-moves the rhs value)
- optional& operator= ( optional && rhs )
- BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && ::boost::is_nothrow_move_assignable<T>::value)
- {
- this->assign( static_cast<base &&>(rhs) ) ;
- return *this ;
- }
-#endif
-
- // Assigns from a T (deep-copies the rhs value)
- // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED
- optional& operator= ( argument_type val )
- {
- this->assign( val ) ;
- return *this ;
- }
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- // Assigns from a T (deep-moves the rhs value)
- optional& operator= ( rval_reference_type val )
- {
- optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref<T, rval_reference_type>();
- this->assign( boost::move(val) ) ;
- return *this ;
- }
-#endif
-
- // Assigns from a "none"
- // Which destroys the current value, if any, leaving this UNINITIALIZED
- // No-throw (assuming T::~T() doesn't)
- optional& operator= ( none_t none_ ) BOOST_NOEXCEPT
- {
- this->assign( none_ ) ;
- return *this ;
- }
-
-#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- // Constructs in-place
- // upon exception *this is always uninitialized
- template<class... Args>
- void emplace ( Args&&... args )
- {
- this->emplace_assign( boost::forward<Args>(args)... );
- }
-#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template<class Arg>
- void emplace ( Arg&& arg )
- {
- this->emplace_assign( boost::forward<Arg>(arg) );
- }
-
- void emplace ()
- {
- this->emplace_assign();
- }
-#else
- template<class Arg>
- void emplace ( const Arg& arg )
- {
- this->emplace_assign( arg );
- }
-
- template<class Arg>
- void emplace ( Arg& arg )
- {
- this->emplace_assign( arg );
- }
-
- void emplace ()
- {
- this->emplace_assign();
- }
-#endif
-
- void swap( optional & arg )
- BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && ::boost::is_nothrow_move_assignable<T>::value)
- {
- // allow for Koenig lookup
- boost::core::invoke_swap(*this, arg);
- }
-
-
- // Returns a reference to the value if this is initialized, otherwise,
- // the behaviour is UNDEFINED
- // No-throw
- reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); }
- reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); }
-
- // Returns a copy of the value if this is initialized, 'v' otherwise
- reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; }
- reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; }
-
- // Returns a pointer to the value if this is initialized, otherwise,
- // the behaviour is UNDEFINED
- // No-throw
- pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; }
- pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; }
-
- // Returns a reference to the value if this is initialized, otherwise,
- // the behaviour is UNDEFINED
- // No-throw
-#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- reference_const_type operator *() const& { return this->get() ; }
- reference_type operator *() & { return this->get() ; }
- reference_type_of_temporary_wrapper operator *() && { return base::types::move(this->get()) ; }
-#else
- reference_const_type operator *() const { return this->get() ; }
- reference_type operator *() { return this->get() ; }
-#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
-
-#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- reference_const_type value() const&
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-
- reference_type value() &
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-
- reference_type_of_temporary_wrapper value() &&
- {
- if (this->is_initialized())
- return base::types::move(this->get()) ;
- else
- throw_exception(bad_optional_access());
- }
-
-#else
- reference_const_type value() const
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-
- reference_type value()
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-#endif
-
-
-#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
- template <class U>
- value_type value_or ( U&& v ) const&
- {
- if (this->is_initialized())
- return get();
- else
- return boost::forward<U>(v);
- }
-
- template <class U>
- value_type value_or ( U&& v ) &&
- {
- if (this->is_initialized())
- return base::types::move(get());
- else
- return boost::forward<U>(v);
- }
-#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- template <class U>
- value_type value_or ( U&& v ) const
- {
- if (this->is_initialized())
- return get();
- else
- return boost::forward<U>(v);
- }
-#else
- template <class U>
- value_type value_or ( U const& v ) const
- {
- if (this->is_initialized())
- return get();
- else
- return v;
- }
-
- template <class U>
- value_type value_or ( U& v ) const
- {
- if (this->is_initialized())
- return get();
- else
- return v;
- }
-#endif
-
-
-#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
- template <typename F>
- value_type value_or_eval ( F f ) const&
- {
- if (this->is_initialized())
- return get();
- else
- return f();
- }
-
- template <typename F>
- value_type value_or_eval ( F f ) &&
- {
- if (this->is_initialized())
- return base::types::move(get());
- else
- return f();
- }
-#else
- template <typename F>
- value_type value_or_eval ( F f ) const
- {
- if (this->is_initialized())
- return get();
- else
- return f();
- }
-#endif
-
- bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; }
-
- BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
-} ;
-
-} // namespace boost
-
-
-#endif // header guard
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_aligned_storage.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_aligned_storage.hpp
index b290921d354..704cadb6f08 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_aligned_storage.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_aligned_storage.hpp
@@ -60,9 +60,8 @@ class aligned_storage
T * ptr_ref() { return static_cast<T *> (address()); }
#endif
- T const& ref() const { return *ptr_ref(); }
- T & ref() { return *ptr_ref(); }
-
+ T const& ref() const { return *boost::core::launder(ptr_ref()); }
+ T & ref() { return *boost::core::launder(ptr_ref()); }
} ;
} // namespace optional_detail
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_config.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_config.hpp
index b5040a4704e..b7ccc3e69f7 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_config.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_config.hpp
@@ -14,9 +14,9 @@
#define BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP
#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
+#include <boost/config/workaround.hpp>
-#if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES)
+#if (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES)
# define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
#endif
@@ -55,7 +55,7 @@
#if (defined(_MSC_VER) && _MSC_VER <= 1800)
// on MSVC 2013 and earlier an unwanted temporary is created when you assign from
// a const lvalue of integral type. Thus we bind not to the original address but
-// to a temporary.
+// to a temporary.
# define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT
#endif
@@ -82,7 +82,7 @@
#endif // defined(__GNUC__)
-#if (defined __GNUC__) && (!defined BOOST_NO_CXX11_RVALUE_REFERENCES)
+#if (defined __GNUC__)
// On some initial rvalue reference implementations GCC does it in a strange way,
// preferring perfect-forwarding constructor to implicit copy constructor.
@@ -132,4 +132,13 @@
#endif
+#ifdef BOOST_NO_CXX11_REF_QUALIFIERS
+# define BOOST_OPTIONAL_CONST_REF_QUAL const
+# define BOOST_OPTIONAL_REF_QUAL
+#else
+# define BOOST_OPTIONAL_CONST_REF_QUAL const&
+# define BOOST_OPTIONAL_REF_QUAL &
+#endif
+
+
#endif // header guard
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_reference_spec.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_reference_spec.hpp
index b013f0b5dc4..d8405f82a23 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_reference_spec.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_reference_spec.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2018 Andrzej Krzemienski.
+// Copyright (C) 2015-2024 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
@@ -29,17 +29,17 @@ template <class From>
void prevent_binding_rvalue()
{
#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES
- BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference<From>::value,
- "binding rvalue references to optional lvalue references is disallowed");
-#endif
+ static_assert(boost::is_lvalue_reference<From>::value,
+ "binding rvalue references to optional lvalue references is disallowed");
+#endif
}
template <class T>
BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::type& forward_reference(T&& r)
{
- BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference<T>::value,
- "binding rvalue references to optional lvalue references is disallowed");
- return boost::forward<T>(r);
+ static_assert(boost::is_lvalue_reference<T>::value,
+ "binding rvalue references to optional lvalue references is disallowed");
+ return optional_detail::forward<T>(r);
}
#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
@@ -68,10 +68,10 @@ void prevent_assignment_from_false_const_integral()
#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT
// MSVC compiler without rvalue references: we need to disable the assignment from
// const integral lvalue reference, as it may be an invalid temporary
- BOOST_STATIC_ASSERT_MSG(!is_const_integral<From>::value,
- "binding const lvalue references to integral types is disabled in this compiler");
+ static_assert(!is_const_integral<From>::value,
+ "binding const lvalue references to integral types is disabled in this compiler");
+#endif
#endif
-#endif
}
@@ -114,7 +114,7 @@ template <class T>
class optional<T&> : public optional_detail::optional_tag
{
T* ptr_;
-
+
public:
typedef T& value_type;
typedef T& reference_type;
@@ -122,19 +122,19 @@ public:
typedef T& rval_reference_type;
typedef T* pointer_type;
typedef T* pointer_const_type;
-
+
optional() BOOST_NOEXCEPT : ptr_() {}
- optional(none_t) BOOST_NOEXCEPT : ptr_() {}
+ optional(none_t) BOOST_NOEXCEPT : ptr_() {}
template <class U>
explicit optional(const optional<U&>& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {}
optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {}
-
+
// the following two implement a 'conditionally explicit' constructor: condition is a hack for buggy compilers with screwed conversion construction from const int
template <class U>
explicit optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c<detail::is_same_decayed<T, U>::value && detail::is_const_integral_bad_for_conversion<U>::value, bool>::type = true) BOOST_NOEXCEPT
: ptr_(boost::addressof(rhs)) {}
-
+
template <class U>
optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c<detail::is_same_decayed<T, U>::value && !detail::is_const_integral_bad_for_conversion<U>::value, bool>::type = true) BOOST_NOEXCEPT
: ptr_(boost::addressof(rhs)) {}
@@ -143,15 +143,15 @@ public:
template <class U>
optional& operator=(const optional<U&>& rhs) BOOST_NOEXCEPT { ptr_ = rhs.get_ptr(); return *this; }
optional& operator=(none_t) BOOST_NOEXCEPT { ptr_ = 0; return *this; }
-
-
+
+
void swap(optional& rhs) BOOST_NOEXCEPT { std::swap(ptr_, rhs.ptr_); }
T& get() const { BOOST_ASSERT(ptr_); return *ptr_; }
T* get_ptr() const BOOST_NOEXCEPT { return ptr_; }
T* operator->() const { BOOST_ASSERT(ptr_); return ptr_; }
T& operator*() const { BOOST_ASSERT(ptr_); return *ptr_; }
-
+
T& value() const
{
if (this->is_initialized())
@@ -159,17 +159,17 @@ public:
else
throw_exception(bad_optional_access());
}
-
- bool operator!() const BOOST_NOEXCEPT { return ptr_ == 0; }
- BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
-
+
+ explicit operator bool() const BOOST_NOEXCEPT { return ptr_ != 0; }
+
void reset() BOOST_NOEXCEPT { ptr_ = 0; }
bool is_initialized() const BOOST_NOEXCEPT { return ptr_ != 0; }
bool has_value() const BOOST_NOEXCEPT { return ptr_ != 0; }
-
+
template <typename F>
- optional<typename boost::result_of<F(T&)>::type> map(F f) const
+ optional<typename optional_detail::result_of<F, reference_const_type>::type>
+ map(F f) const
{
if (this->has_value())
return f(this->get());
@@ -178,61 +178,62 @@ public:
}
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(T&)>::type>::type> flat_map(F f) const
+ optional<typename optional_detail::result_value_type<F, reference_const_type>::type>
+ flat_map(F f) const
{
if (this->has_value())
return f(get());
else
return none;
}
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
+
+#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
+
optional(T&& /* rhs */) BOOST_NOEXCEPT { detail::prevent_binding_rvalue<T&&>(); }
-
+
template <class R>
optional(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::no_unboxing_cond<T, R>, bool>::type = true) BOOST_NOEXCEPT
: ptr_(boost::addressof(r)) { detail::prevent_binding_rvalue<R>(); }
-
+
template <class R>
optional(bool cond, R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, bool>::type = true) BOOST_NOEXCEPT
: ptr_(cond ? boost::addressof(r) : 0) { detail::prevent_binding_rvalue<R>(); }
-
+
template <class R>
BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, optional<T&>&>::type
operator=(R&& r) BOOST_NOEXCEPT { detail::prevent_binding_rvalue<R>(); ptr_ = boost::addressof(r); return *this; }
-
+
template <class R>
void emplace(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, bool>::type = true) BOOST_NOEXCEPT
{ detail::prevent_binding_rvalue<R>(); ptr_ = boost::addressof(r); }
-
+
template <class R>
T& get_value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, bool>::type = true) const BOOST_NOEXCEPT
{ detail::prevent_binding_rvalue<R>(); return ptr_ ? *ptr_ : r; }
-
+
template <class R>
T& value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, bool>::type = true) const BOOST_NOEXCEPT
{ detail::prevent_binding_rvalue<R>(); return ptr_ ? *ptr_ : r; }
-
+
template <class R>
void reset(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<R>, bool>::type = true) BOOST_NOEXCEPT
{ detail::prevent_binding_rvalue<R>(); ptr_ = boost::addressof(r); }
-
+
template <class F>
T& value_or_eval(F f) const { return ptr_ ? *ptr_ : detail::forward_reference(f()); }
-
+
#else // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
+
// the following two implement a 'conditionally explicit' constructor
template <class U>
explicit optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c<detail::no_unboxing_cond<T, U>::value && detail::is_const_integral_bad_for_conversion<U>::value, bool>::type = true) BOOST_NOEXCEPT
: ptr_(boost::addressof(v)) { }
-
+
template <class U>
optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c<detail::no_unboxing_cond<T, U>::value && !detail::is_const_integral_bad_for_conversion<U>::value, bool>::type = true) BOOST_NOEXCEPT
: ptr_(boost::addressof(v)) { }
-
+
template <class U>
optional(bool cond, U& v, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<U>, bool>::type = true) BOOST_NOEXCEPT : ptr_(cond ? boost::addressof(v) : 0) {}
@@ -247,26 +248,26 @@ public:
template <class U>
void emplace(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<U>, bool>::type = true) BOOST_NOEXCEPT
{ ptr_ = boost::addressof(v); }
-
+
template <class U>
T& get_value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<U>, bool>::type = true) const BOOST_NOEXCEPT
{ return ptr_ ? *ptr_ : v; }
-
+
template <class U>
T& value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<U>, bool>::type = true) const BOOST_NOEXCEPT
{ return ptr_ ? *ptr_ : v; }
-
+
template <class U>
void reset(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if<detail::is_no_optional<U>, bool>::type = true) BOOST_NOEXCEPT
{ ptr_ = boost::addressof(v); }
-
+
template <class F>
T& value_or_eval(F f) const { return ptr_ ? *ptr_ : f(); }
-
+
#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
};
-template <class T>
+template <class T>
void swap ( optional<T&>& x, optional<T&>& y) BOOST_NOEXCEPT
{
x.swap(y);
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_relops.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_relops.hpp
index 1c155787bef..dc558ea678d 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_relops.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_relops.hpp
@@ -1,5 +1,5 @@
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
-// Copyright (C) 2015 Andrzej Krzemienski.
+// Copyright (C) 2015, 2024 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
@@ -16,7 +16,8 @@
namespace boost {
// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values).
-// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointees() in generic code instead.
+// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointees() in generic code instead,
+// to obtain the same semantic for pointers.
//
@@ -31,7 +32,7 @@ bool operator == ( optional<T> const& x, optional<T> const& y )
template<class T>
inline
bool operator < ( optional<T> const& x, optional<T> const& y )
-{ return less_pointees(x,y); }
+{ return !y ? false : (!x ? true : (*x) < (*y)); }
template<class T>
inline
@@ -60,12 +61,12 @@ bool operator >= ( optional<T> const& x, optional<T> const& y )
template<class T>
inline
bool operator == ( optional<T> const& x, T const& y )
-{ return equal_pointees(x, optional<T>(y)); }
+{ return x && (*x == y); }
template<class T>
inline
bool operator < ( optional<T> const& x, T const& y )
-{ return less_pointees(x, optional<T>(y)); }
+{ return (!x) || (*x < y); }
template<class T>
inline
@@ -94,12 +95,12 @@ bool operator >= ( optional<T> const& x, T const& y )
template<class T>
inline
bool operator == ( T const& x, optional<T> const& y )
-{ return equal_pointees( optional<T>(x), y ); }
+{ return y && (x == *y); }
template<class T>
inline
bool operator < ( T const& x, optional<T> const& y )
-{ return less_pointees( optional<T>(x), y ); }
+{ return y && (x < *y); }
template<class T>
inline
@@ -133,8 +134,8 @@ bool operator == ( optional<T> const& x, none_t ) BOOST_NOEXCEPT
template<class T>
inline
-bool operator < ( optional<T> const& x, none_t )
-{ return less_pointees(x,optional<T>() ); }
+bool operator < ( optional<T> const&, none_t )
+{ return false; }
template<class T>
inline
@@ -168,7 +169,7 @@ bool operator == ( none_t , optional<T> const& y ) BOOST_NOEXCEPT
template<class T>
inline
bool operator < ( none_t , optional<T> const& y )
-{ return less_pointees(optional<T>() ,y); }
+{ return bool(y); }
template<class T>
inline
@@ -193,4 +194,3 @@ bool operator >= ( none_t x, optional<T> const& y )
} // namespace boost
#endif // header guard
-
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_swap.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_swap.hpp
index f4eceabb509..f1d301b4edd 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_swap.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_swap.hpp
@@ -54,7 +54,7 @@ struct swap_selector<true>
#endif
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) boost::move(EXPR_)
+# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) optional_detail::move(EXPR_)
#else
# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) EXPR_
#endif
@@ -63,7 +63,7 @@ template <>
struct swap_selector<false>
{
template <class T>
- static void optional_swap ( optional<T>& x, optional<T>& y )
+ static void optional_swap ( optional<T>& x, optional<T>& y )
//BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && BOOST_NOEXCEPT_EXPR(boost::core::invoke_swap(*x, *y)))
{
if (x)
@@ -91,7 +91,7 @@ struct swap_selector<false>
} // namespace optional_detail
-#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined BOOST_CONFIG_RESTORE_OBSOLETE_SWAP_IMPLEMENTATION)
+#if (!defined BOOST_CONFIG_RESTORE_OBSOLETE_SWAP_IMPLEMENTATION)
template<class T>
struct optional_swap_should_use_default_constructor : boost::false_type {} ;
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_trivially_copyable_base.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_trivially_copyable_base.hpp
index 8d98a84496b..3a08f7d8a81 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_trivially_copyable_base.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_trivially_copyable_base.hpp
@@ -25,21 +25,19 @@ class tc_optional_base : public optional_tag
protected:
typedef T & reference_type ;
typedef T const& reference_const_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
typedef T && rval_reference_type ;
typedef T && reference_type_of_temporary_wrapper ;
-#endif
typedef T * pointer_type ;
typedef T const* pointer_const_type ;
typedef T const& argument_type ;
tc_optional_base()
:
- m_initialized(false) {}
+ m_initialized(false), m_storage() {}
tc_optional_base ( none_t )
:
- m_initialized(false) {}
+ m_initialized(false), m_storage() {}
tc_optional_base ( init_value_tag, argument_type val )
:
@@ -51,31 +49,14 @@ class tc_optional_base : public optional_tag
// tc_optional_base ( tc_optional_base const& ) = default;
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
template<class Expr, class PtrExpr>
explicit tc_optional_base ( Expr&& expr, PtrExpr const* tag )
:
m_initialized(false)
{
- construct(boost::forward<Expr>(expr),tag);
- }
-
-#else
- // This is used for both converting and in-place constructions.
- // Derived classes use the 'tag' to select the appropriate
- // implementation (the correct 'construct()' overload)
- template<class Expr>
- explicit tc_optional_base ( Expr const& expr, Expr const* tag )
- :
- m_initialized(false)
- {
- construct(expr,tag);
+ construct(optional_detail::forward<Expr>(expr),tag);
}
-#endif
-
// tc_optional_base& operator= ( tc_optional_base const& ) = default;
// ~tc_optional_base() = default;
@@ -99,7 +80,6 @@ class tc_optional_base : public optional_tag
m_initialized = rhs.is_initialized();
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// move-assigns from another _convertible_ optional<U> (deep-moves from the rhs value)
template<class U>
void assign ( optional<U>&& rhs )
@@ -109,7 +89,6 @@ class tc_optional_base : public optional_tag
m_storage = static_cast<ref_type>(rhs.get());
m_initialized = rhs.is_initialized();
}
-#endif
void assign ( argument_type val )
{
@@ -120,19 +99,11 @@ class tc_optional_base : public optional_tag
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr, class ExprPtr>
void assign_expr ( Expr&& expr, ExprPtr const* tag )
{
- construct(boost::forward<Expr>(expr),tag);
+ construct(optional_detail::forward<Expr>(expr),tag);
}
-#else
- template<class Expr>
- void assign_expr ( Expr const& expr, Expr const* tag )
- {
- construct(expr,tag);
- }
-#endif
#endif
@@ -162,20 +133,19 @@ class tc_optional_base : public optional_tag
}
-#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// Constructs in-place
// upon exception *this is always uninitialized
template<class... Args>
void construct ( in_place_init_t, Args&&... args )
{
- m_storage = value_type( boost::forward<Args>(args)... ) ;
+ m_storage = value_type( optional_detail::forward<Args>(args)... ) ;
m_initialized = true ;
}
template<class... Args>
void emplace_assign ( Args&&... args )
{
- construct(in_place_init, boost::forward<Args>(args)...);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
template<class... Args>
@@ -183,7 +153,7 @@ class tc_optional_base : public optional_tag
:
m_initialized(false)
{
- construct(in_place_init, boost::forward<Args>(args)...);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
template<class... Args>
@@ -192,148 +162,11 @@ class tc_optional_base : public optional_tag
m_initialized(false)
{
if ( cond )
- construct(in_place_init, boost::forward<Args>(args)...);
- }
-#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template<class Arg>
- void construct ( in_place_init_t, Arg&& arg )
- {
- m_storage = value_type( boost::forward<Arg>(arg) );
- m_initialized = true ;
- }
-
- void construct ( in_place_init_t )
- {
- m_storage = value_type();
- m_initialized = true ;
- }
-
- template<class Arg>
- void emplace_assign ( Arg&& arg )
- {
- construct(in_place_init, boost::forward<Arg>(arg)) ;
- }
-
- void emplace_assign ()
- {
- construct(in_place_init) ;
- }
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_t, Arg&& arg )
- :
- m_initialized(false)
- {
- construct(in_place_init, boost::forward<Arg>(arg));
- }
-
- explicit tc_optional_base ( in_place_init_t )
- :
- m_initialized(false), m_storage() {}
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg&& arg )
- :
- m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, boost::forward<Arg>(arg));
- }
-
- explicit tc_optional_base ( in_place_init_if_t, bool cond )
- :
- m_initialized(false)
- {
- if ( cond )
- construct(in_place_init);
- }
-
-#else
-
- template<class Arg>
- void construct ( in_place_init_t, const Arg& arg )
- {
- m_storage = value_type( arg );
- m_initialized = true ;
- }
-
- template<class Arg>
- void construct ( in_place_init_t, Arg& arg )
- {
- m_storage = value_type( arg );
- m_initialized = true ;
- }
-
- void construct ( in_place_init_t )
- {
- m_storage = value_type();
- m_initialized = true ;
- }
-
- template<class Arg>
- void emplace_assign ( const Arg& arg )
- {
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- void emplace_assign ( Arg& arg )
- {
- construct(in_place_init, arg);
- }
-
- void emplace_assign ()
- {
- construct(in_place_init);
- }
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_t, const Arg& arg )
- : m_initialized(false)
- {
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_t, Arg& arg )
- : m_initialized(false)
- {
- construct(in_place_init, arg);
- }
-
- explicit tc_optional_base ( in_place_init_t )
- : m_initialized(false)
- {
- construct(in_place_init);
- }
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_if_t, bool cond, const Arg& arg )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg& arg )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, arg);
- }
-
- explicit tc_optional_base ( in_place_init_if_t, bool cond )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
-#endif
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Constructs in-place using the given factory
template<class Expr>
void construct ( Expr&& factory, in_place_factory_base const* )
@@ -365,42 +198,8 @@ class tc_optional_base : public optional_tag
construct(factory,tag);
}
-#else
- // Constructs in-place using the given factory
- template<class Expr>
- void construct ( Expr const& factory, in_place_factory_base const* )
- {
- boost_optional_detail::construct<value_type>(factory, boost::addressof(m_storage));
- m_initialized = true ;
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void construct ( Expr const& factory, typed_in_place_factory_base const* )
- {
- factory.apply(boost::addressof(m_storage)) ;
- m_initialized = true ;
- }
-
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-#endif
-
#endif
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Constructs using any expression implicitly convertible to the single argument
// of a one-argument T constructor.
// Converting constructions of optional<T> from optional<U> uses this function with
@@ -408,7 +207,7 @@ class tc_optional_base : public optional_tag
template<class Expr>
void construct ( Expr&& expr, void const* )
{
- m_storage = value_type(boost::forward<Expr>(expr)) ;
+ m_storage = value_type(optional_detail::forward<Expr>(expr)) ;
m_initialized = true ;
}
@@ -419,31 +218,8 @@ class tc_optional_base : public optional_tag
template<class Expr>
void assign_expr_to_initialized ( Expr&& expr, void const* )
{
- assign_value( boost::forward<Expr>(expr) );
+ assign_value( optional_detail::forward<Expr>(expr) );
}
-#else
- // Constructs using any expression implicitly convertible to the single argument
- // of a one-argument T constructor.
- // Converting constructions of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
- template<class Expr>
- void construct ( Expr const& expr, void const* )
- {
- m_storage = value_type(expr) ;
- m_initialized = true ;
- }
-
- // Assigns using a form any expression implicitly convertible to the single argument
- // of a T's assignment operator.
- // Converting assignments of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& expr, void const* )
- {
- assign_value(expr);
- }
-
-#endif
#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
// BCB5.64 (and probably lower versions) workaround.
@@ -458,7 +234,7 @@ class tc_optional_base : public optional_tag
// For VC<=70 compilers this workaround doesn't work because the compiler issues and error
// instead of choosing the wrong overload
//
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
+
// Notice that 'Expr' will be optional<T> or optional<U> (but not tc_optional_base<..>)
template<class Expr>
void construct ( Expr&& expr, optional_tag const* )
@@ -467,30 +243,14 @@ class tc_optional_base : public optional_tag
{
// An exception can be thrown here.
// It it happens, THIS will be left uninitialized.
- m_storage = value_type(boost::move(expr.get())) ;
- m_initialized = true ;
- }
- }
-#else
- // Notice that 'Expr' will be optional<T> or optional<U> (but not tc_optional_base<..>)
- template<class Expr>
- void construct ( Expr const& expr, optional_tag const* )
- {
- if ( expr.is_initialized() )
- {
- // An exception can be thrown here.
- // It it happens, THIS will be left uninitialized.
- m_storage = value_type(expr.get()) ;
+ m_storage = value_type(optional_detail::move(expr.get())) ;
m_initialized = true ;
}
}
-#endif
#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
void assign_value ( argument_type val ) { m_storage = val; }
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
void assign_value ( rval_reference_type val ) { m_storage = static_cast<rval_reference_type>(val); }
-#endif
void destroy()
{
diff --git a/contrib/restricted/boost/optional/include/boost/optional/detail/optional_utility.hpp b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_utility.hpp
new file mode 100644
index 00000000000..f7c04ffecd6
--- /dev/null
+++ b/contrib/restricted/boost/optional/include/boost/optional/detail/optional_utility.hpp
@@ -0,0 +1,41 @@
+// Copyright (C) 2024 Ryan Malcolm Underwood.
+//
+// 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/libs/optional for documentation.
+//
+// You are welcome to contact the author at:
+
+#ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_UTILITY_RMU_06OCT2024_HPP
+#define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_UTILITY_RMU_06OCT2024_HPP
+
+namespace boost {
+namespace optional_detail {
+
+// Workaround: forward and move aren't constexpr in C++11
+template <class T>
+inline constexpr T&& forward(typename boost::remove_reference<T>::type& t) noexcept
+{
+ return static_cast<T&&>(t);
+}
+
+template <class T>
+inline constexpr T&& forward(typename boost::remove_reference<T>::type&& t) noexcept
+{
+ static_assert(!boost::is_lvalue_reference<T>::value, "Can not forward an rvalue as an lvalue.");
+ return static_cast<T&&>(t);
+}
+
+template <class T>
+inline constexpr typename boost::remove_reference<T>::type&& move(T&& t) noexcept
+{
+ return static_cast<typename boost::remove_reference<T>::type&&>(t);
+}
+
+} // namespace optional_detail
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/optional/include/boost/optional/optional.hpp b/contrib/restricted/boost/optional/include/boost/optional/optional.hpp
index f5fdf992fc3..b8f402d87bf 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/optional.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/optional.hpp
@@ -22,19 +22,13 @@
#include <iosfwd>
#endif // BOOST_NO_IOSTREAM
-#ifdef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
-# include <type_traits>
-#endif
-
#include <boost/assert.hpp>
#include <boost/core/addressof.hpp>
#include <boost/core/enable_if.hpp>
-#include <boost/core/explicit_operator_bool.hpp>
#include <boost/core/invoke_swap.hpp>
+#include <boost/core/launder.hpp>
#include <boost/optional/bad_optional_access.hpp>
-#include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp>
-#include <boost/type.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/conjunction.hpp>
@@ -56,16 +50,14 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_scalar.hpp>
-#include <boost/move/utility.hpp>
#include <boost/none.hpp>
-#include <boost/utility/compare_pointees.hpp>
-#include <boost/utility/result_of.hpp>
#include <boost/optional/optional_fwd.hpp>
#include <boost/optional/detail/optional_config.hpp>
#include <boost/optional/detail/optional_factory_support.hpp>
#include <boost/optional/detail/optional_aligned_storage.hpp>
#include <boost/optional/detail/optional_hash.hpp>
+#include <boost/optional/detail/optional_utility.hpp>
namespace boost { namespace optional_detail {
@@ -74,17 +66,34 @@ struct optional_value_type
{
};
+template <typename U>
+struct optional_value_type< ::boost::optional<U> >
+{
+ typedef U type;
+};
+
template <typename T>
-struct optional_value_type< ::boost::optional<T> >
+T declval();
+
+
+// implementing my own result_of so that it works for C++11 (std::result_of)
+// and in C++20 (std::invoke_result).
+template <typename F, typename Ref, typename Rslt = decltype(declval<F>()(declval<Ref>()))>
+struct result_of
+{
+ typedef Rslt type;
+};
+
+template <typename F, typename Ref, typename Rslt = typename optional_value_type<typename result_of<F, Ref>::type>::type>
+struct result_value_type
{
- typedef T type;
+ typedef Rslt type;
};
+// optional<typename optional_detail::optional_value_type<decltype(optional_detail::declval<F>()(optional_detail::declval<reference_type>()))>::type>
+
}} // namespace boost::optional_detail
-#ifdef BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL
-#include <boost/optional/detail/old_optional_implementation.hpp>
-#else
namespace boost {
namespace optional_ns {
@@ -93,17 +102,17 @@ namespace optional_ns {
struct in_place_init_t
{
struct init_tag{};
- explicit in_place_init_t(init_tag){}
+ BOOST_CONSTEXPR explicit in_place_init_t(init_tag){}
};
-const in_place_init_t in_place_init ((in_place_init_t::init_tag()));
+BOOST_INLINE_CONSTEXPR in_place_init_t in_place_init ((in_place_init_t::init_tag()));
// a tag for conditional in-place initialization of contained value
struct in_place_init_if_t
{
struct init_tag{};
- explicit in_place_init_if_t(init_tag){}
+ BOOST_CONSTEXPR explicit in_place_init_if_t(init_tag){}
};
-const in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag()));
+BOOST_INLINE_CONSTEXPR in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag()));
} // namespace optional_ns
@@ -135,10 +144,8 @@ class optional_base : public optional_tag
protected:
typedef T & reference_type ;
typedef T const& reference_const_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
typedef T && rval_reference_type ;
typedef T && reference_type_of_temporary_wrapper ;
-#endif
typedef T * pointer_type ;
typedef T const* pointer_const_type ;
typedef T const& argument_type ;
@@ -164,16 +171,14 @@ class optional_base : public optional_tag
construct(val);
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// move-construct an optional<T> initialized from an rvalue-ref to 'val'.
// Can throw if T::T(T&&) does
optional_base ( init_value_tag, rval_reference_type val )
:
m_initialized(false)
{
- construct( boost::move(val) );
+ construct( optional_detail::move(val) );
}
-#endif
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional<T>.
// Can throw if T::T(T const&) does
@@ -185,7 +190,6 @@ class optional_base : public optional_tag
construct(val);
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates an optional<T> initialized with 'move(val)' IFF cond is true, otherwise creates an uninitialized optional<T>.
// Can throw if T::T(T &&) does
optional_base ( bool cond, rval_reference_type val )
@@ -193,9 +197,8 @@ class optional_base : public optional_tag
m_initialized(false)
{
if ( cond )
- construct(boost::move(val));
+ construct(optional_detail::move(val));
}
-#endif
// Creates a deep copy of another optional<T>
// Can throw if T::T(T const&) does
@@ -207,7 +210,6 @@ class optional_base : public optional_tag
construct(rhs.get_impl());
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates a deep move of another optional<T>
// Can throw if T::T(T&&) does
optional_base ( optional_base&& rhs )
@@ -216,48 +218,30 @@ class optional_base : public optional_tag
m_initialized(false)
{
if ( rhs.is_initialized() )
- construct( boost::move(rhs.get_impl()) );
+ construct( optional_detail::move(rhs.get_impl()) );
}
-#endif
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr, class PtrExpr>
explicit optional_base ( Expr&& expr, PtrExpr const* tag )
:
m_initialized(false)
{
- construct(boost::forward<Expr>(expr),tag);
- }
-
-#else
- // This is used for both converting and in-place constructions.
- // Derived classes use the 'tag' to select the appropriate
- // implementation (the correct 'construct()' overload)
- template<class Expr>
- explicit optional_base ( Expr const& expr, Expr const* tag )
- :
- m_initialized(false)
- {
- construct(expr,tag);
+ construct(optional_detail::forward<Expr>(expr),tag);
}
-#endif
-
optional_base& operator= ( optional_base const& rhs )
{
this->assign(rhs);
return *this;
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
optional_base& operator= ( optional_base && rhs )
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && ::boost::is_nothrow_move_assignable<T>::value)
{
this->assign(static_cast<optional_base&&>(rhs));
return *this;
}
-#endif
// No-throw (assuming T::~T() doesn't)
~optional_base() { destroy() ; }
@@ -278,23 +262,21 @@ class optional_base : public optional_tag
}
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Assigns from another optional<T> (deep-moves the rhs value)
void assign ( optional_base&& rhs )
{
if (is_initialized())
{
if ( rhs.is_initialized() )
- assign_value( boost::move(rhs.get_impl()) );
+ assign_value( optional_detail::move(rhs.get_impl()) );
else destroy();
}
else
{
if ( rhs.is_initialized() )
- construct(boost::move(rhs.get_impl()));
+ construct(optional_detail::move(rhs.get_impl()));
}
}
-#endif
// Assigns from another _convertible_ optional<U> (deep-copies the rhs value)
template<class U>
@@ -322,7 +304,6 @@ class optional_base : public optional_tag
}
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// move-assigns from another _convertible_ optional<U> (deep-moves from the rhs value)
template<class U>
void assign ( optional<U>&& rhs )
@@ -340,7 +321,6 @@ class optional_base : public optional_tag
construct(static_cast<ref_type>(rhs.get()));
}
}
-#endif
// Assigns from a T (deep-copies the rhs value)
void assign ( argument_type val )
@@ -350,15 +330,13 @@ class optional_base : public optional_tag
else construct(val);
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Assigns from a T (deep-moves the rhs value)
void assign ( rval_reference_type val )
{
if (is_initialized())
- assign_value( boost::move(val) );
- else construct( boost::move(val) );
+ assign_value( optional_detail::move(val) );
+ else construct( optional_detail::move(val) );
}
-#endif
// Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
@@ -366,23 +344,13 @@ class optional_base : public optional_tag
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr, class ExprPtr>
void assign_expr ( Expr&& expr, ExprPtr const* tag )
{
if (is_initialized())
- assign_expr_to_initialized(boost::forward<Expr>(expr),tag);
- else construct(boost::forward<Expr>(expr),tag);
- }
-#else
- template<class Expr>
- void assign_expr ( Expr const& expr, Expr const* tag )
- {
- if (is_initialized())
- assign_expr_to_initialized(expr,tag);
- else construct(expr,tag);
+ assign_expr_to_initialized(optional_detail::forward<Expr>(expr),tag);
+ else construct(optional_detail::forward<Expr>(expr),tag);
}
-#endif
#endif
@@ -411,22 +379,19 @@ class optional_base : public optional_tag
m_initialized = true ;
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
void construct ( rval_reference_type val )
{
- ::new (m_storage.address()) unqualified_value_type( boost::move(val) ) ;
+ ::new (m_storage.address()) unqualified_value_type( optional_detail::move(val) ) ;
m_initialized = true ;
}
-#endif
-#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// Constructs in-place
// upon exception *this is always uninitialized
template<class... Args>
void construct ( in_place_init_t, Args&&... args )
{
- ::new (m_storage.address()) unqualified_value_type( boost::forward<Args>(args)... ) ;
+ ::new (m_storage.address()) unqualified_value_type( optional_detail::forward<Args>(args)... ) ;
m_initialized = true ;
}
@@ -434,7 +399,7 @@ class optional_base : public optional_tag
void emplace_assign ( Args&&... args )
{
destroy();
- construct(in_place_init, boost::forward<Args>(args)...);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
template<class... Args>
@@ -442,7 +407,7 @@ class optional_base : public optional_tag
:
m_initialized(false)
{
- construct(in_place_init, boost::forward<Args>(args)...);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
template<class... Args>
@@ -451,156 +416,11 @@ class optional_base : public optional_tag
m_initialized(false)
{
if ( cond )
- construct(in_place_init, boost::forward<Args>(args)...);
- }
-#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template<class Arg>
- void construct ( in_place_init_t, Arg&& arg )
- {
- ::new (m_storage.address()) unqualified_value_type( boost::forward<Arg>(arg) );
- m_initialized = true ;
- }
-
- void construct ( in_place_init_t )
- {
- ::new (m_storage.address()) unqualified_value_type();
- m_initialized = true ;
- }
-
- template<class Arg>
- void emplace_assign ( Arg&& arg )
- {
- destroy();
- construct(in_place_init, boost::forward<Arg>(arg)) ;
- }
-
- void emplace_assign ()
- {
- destroy();
- construct(in_place_init) ;
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_t, Arg&& arg )
- :
- m_initialized(false)
- {
- construct(in_place_init, boost::forward<Arg>(arg));
- }
-
- explicit optional_base ( in_place_init_t )
- :
- m_initialized(false)
- {
- construct(in_place_init);
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_if_t, bool cond, Arg&& arg )
- :
- m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, boost::forward<Arg>(arg));
- }
-
- explicit optional_base ( in_place_init_if_t, bool cond )
- :
- m_initialized(false)
- {
- if ( cond )
- construct(in_place_init);
- }
-
-#else
-
- template<class Arg>
- void construct ( in_place_init_t, const Arg& arg )
- {
- ::new (m_storage.address()) unqualified_value_type( arg );
- m_initialized = true ;
- }
-
- template<class Arg>
- void construct ( in_place_init_t, Arg& arg )
- {
- ::new (m_storage.address()) unqualified_value_type( arg );
- m_initialized = true ;
- }
-
- void construct ( in_place_init_t )
- {
- ::new (m_storage.address()) unqualified_value_type();
- m_initialized = true ;
- }
-
- template<class Arg>
- void emplace_assign ( const Arg& arg )
- {
- destroy();
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- void emplace_assign ( Arg& arg )
- {
- destroy();
- construct(in_place_init, arg);
- }
-
- void emplace_assign ()
- {
- destroy();
- construct(in_place_init);
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_t, const Arg& arg )
- : m_initialized(false)
- {
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_t, Arg& arg )
- : m_initialized(false)
- {
- construct(in_place_init, arg);
- }
-
- explicit optional_base ( in_place_init_t )
- : m_initialized(false)
- {
- construct(in_place_init);
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_if_t, bool cond, const Arg& arg )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, arg);
- }
-
- template<class Arg>
- explicit optional_base ( in_place_init_if_t, bool cond, Arg& arg )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init, arg);
- }
-
- explicit optional_base ( in_place_init_if_t, bool cond )
- : m_initialized(false)
- {
- if ( cond )
- construct(in_place_init);
+ construct(in_place_init, optional_detail::forward<Args>(args)...);
}
-#endif
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Constructs in-place using the given factory
template<class Expr>
void construct ( Expr&& factory, in_place_factory_base const* )
@@ -632,42 +452,8 @@ class optional_base : public optional_tag
construct(factory,tag);
}
-#else
- // Constructs in-place using the given factory
- template<class Expr>
- void construct ( Expr const& factory, in_place_factory_base const* )
- {
- boost_optional_detail::construct<value_type>(factory, m_storage.address());
- m_initialized = true ;
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void construct ( Expr const& factory, typed_in_place_factory_base const* )
- {
- factory.apply(m_storage.address()) ;
- m_initialized = true ;
- }
-
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
-
- // Constructs in-place using the given typed factory
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag )
- {
- destroy();
- construct(factory,tag);
- }
#endif
-#endif
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Constructs using any expression implicitly convertible to the single argument
// of a one-argument T constructor.
// Converting constructions of optional<T> from optional<U> uses this function with
@@ -675,7 +461,7 @@ class optional_base : public optional_tag
template<class Expr>
void construct ( Expr&& expr, void const* )
{
- new (m_storage.address()) unqualified_value_type(boost::forward<Expr>(expr)) ;
+ new (m_storage.address()) unqualified_value_type(optional_detail::forward<Expr>(expr)) ;
m_initialized = true ;
}
@@ -686,31 +472,8 @@ class optional_base : public optional_tag
template<class Expr>
void assign_expr_to_initialized ( Expr&& expr, void const* )
{
- assign_value( boost::forward<Expr>(expr) );
+ assign_value( optional_detail::forward<Expr>(expr) );
}
-#else
- // Constructs using any expression implicitly convertible to the single argument
- // of a one-argument T constructor.
- // Converting constructions of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
- template<class Expr>
- void construct ( Expr const& expr, void const* )
- {
- new (m_storage.address()) unqualified_value_type(expr) ;
- m_initialized = true ;
- }
-
- // Assigns using a form any expression implicitly convertible to the single argument
- // of a T's assignment operator.
- // Converting assignments of optional<T> from optional<U> uses this function with
- // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
- template<class Expr>
- void assign_expr_to_initialized ( Expr const& expr, void const* )
- {
- assign_value(expr);
- }
-
-#endif
#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
// BCB5.64 (and probably lower versions) workaround.
@@ -725,7 +488,7 @@ class optional_base : public optional_tag
// For VC<=70 compilers this workaround doesn't work because the compiler issues and error
// instead of choosing the wrong overload
//
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
+
// Notice that 'Expr' will be optional<T> or optional<U> (but not optional_base<..>)
template<class Expr>
void construct ( Expr&& expr, optional_tag const* )
@@ -734,30 +497,14 @@ class optional_base : public optional_tag
{
// An exception can be thrown here.
// It it happens, THIS will be left uninitialized.
- new (m_storage.address()) unqualified_value_type(boost::move(expr.get())) ;
- m_initialized = true ;
- }
- }
-#else
- // Notice that 'Expr' will be optional<T> or optional<U> (but not optional_base<..>)
- template<class Expr>
- void construct ( Expr const& expr, optional_tag const* )
- {
- if ( expr.is_initialized() )
- {
- // An exception can be thrown here.
- // It it happens, THIS will be left uninitialized.
- new (m_storage.address()) unqualified_value_type(expr.get()) ;
+ new (m_storage.address()) unqualified_value_type(optional_detail::move(expr.get())) ;
m_initialized = true ;
}
}
-#endif
#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
void assign_value ( argument_type val ) { get_impl() = val; }
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
void assign_value ( rval_reference_type val ) { get_impl() = static_cast<rval_reference_type>(val); }
-#endif
void destroy()
{
@@ -832,7 +579,6 @@ struct is_optional_constructible : boost::true_type
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
// for is_assignable
-#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES)
// On some initial rvalue reference implementations GCC does it in a strange way,
// preferring perfect-forwarding constructor to implicit copy constructor.
@@ -844,15 +590,6 @@ struct is_opt_assignable
#else
template <typename T, typename U>
-struct is_opt_assignable
- : boost::conjunction<boost::is_convertible<U, T>, boost::is_assignable<T&, U> >
-{};
-
-#endif
-
-#else
-
-template <typename T, typename U>
struct is_opt_assignable : boost::is_convertible<U, T>
{};
@@ -918,10 +655,8 @@ class optional
typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ;
typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ;
typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ;
typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ;
-#endif
typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ;
typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ;
typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ;
@@ -938,23 +673,19 @@ class optional
// Can throw if T::T(T const&) does
optional ( argument_type val ) : base(optional_detail::init_value_tag(), val) {}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates an optional<T> initialized with 'move(val)'.
// Can throw if T::T(T &&) does
- optional ( rval_reference_type val ) : base(optional_detail::init_value_tag(), boost::forward<T>(val))
+ optional ( rval_reference_type val ) : base(optional_detail::init_value_tag(), optional_detail::forward<T>(val))
{}
-#endif
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional.
// Can throw if T::T(T const&) does
optional ( bool cond, argument_type val ) : base(cond,val) {}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
/// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional.
// Can throw if T::T(T &&) does
- optional ( bool cond, rval_reference_type val ) : base( cond, boost::forward<T>(val) )
+ optional ( bool cond, rval_reference_type val ) : base( cond, optional_detail::forward<T>(val) )
{}
-#endif
// NOTE: MSVC needs templated versions first
@@ -974,7 +705,6 @@ class optional
this->construct(rhs.get());
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates a deep move of another convertible optional<U>
// Requires a valid conversion from U to T.
// Can throw if T::T(U&&) does
@@ -988,9 +718,8 @@ class optional
base()
{
if ( rhs.is_initialized() )
- this->construct( boost::move(rhs.get()) );
+ this->construct( optional_detail::move(rhs.get()) );
}
-#endif
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
// Creates an optional<T> with an expression which can be either
@@ -1002,20 +731,15 @@ class optional
// even though explicit overloads are present for these.
// Depending on the above some T ctor is called.
// Can throw if the resolved T ctor throws.
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr>
explicit optional ( Expr&& expr,
BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_val_init_candidate<T, Expr>, bool>::type = true
)
- : base(boost::forward<Expr>(expr),boost::addressof(expr))
+ : base(optional_detail::forward<Expr>(expr),boost::addressof(expr))
{}
-#else
- template<class Expr>
- explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {}
-#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
// Creates a deep copy of another optional<T>
@@ -1026,20 +750,17 @@ class optional
optional ( optional const& rhs ) : base( static_cast<base const&>(rhs) ) {}
#endif
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates a deep move of another optional<T>
// Can throw if T::T(T&&) does
-
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
optional ( optional && ) = default;
#else
optional ( optional && rhs )
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value)
- : base( boost::move(rhs) )
+ : base( optional_detail::move(rhs) )
{}
#endif
-#endif
#if BOOST_WORKAROUND(_MSC_VER, <= 1600)
// On old MSVC compilers the implicitly declared dtor is not called
@@ -1050,24 +771,15 @@ class optional
#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
// Assigns from an expression. See corresponding constructor.
// Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr>
BOOST_DEDUCED_TYPENAME boost::enable_if<optional_detail::is_optional_val_assign_candidate<T, Expr>, optional&>::type
operator= ( Expr&& expr )
{
- this->assign_expr(boost::forward<Expr>(expr),boost::addressof(expr));
+ this->assign_expr(optional_detail::forward<Expr>(expr),boost::addressof(expr));
return *this ;
}
-#else
- template<class Expr>
- optional& operator= ( Expr const& expr )
- {
- this->assign_expr(expr,boost::addressof(expr));
- return *this ;
- }
-#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
// Copy-assigns from another convertible optional<U> (converts && deep-copies the rhs value)
@@ -1080,17 +792,15 @@ class optional
return *this ;
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Move-assigns from another convertible optional<U> (converts && deep-moves the rhs value)
// Requires a valid conversion from U to T.
// Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED
template<class U>
optional& operator= ( optional<U> && rhs )
{
- this->assign(boost::move(rhs));
+ this->assign(optional_detail::move(rhs));
return *this ;
}
-#endif
// Assigns from another optional<T> (deep-copies the rhs value)
// Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED
@@ -1105,7 +815,6 @@ class optional
}
#endif
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Assigns from another optional<T> (deep-moves the rhs value)
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
optional& operator= ( optional && ) = default;
@@ -1118,8 +827,6 @@ class optional
}
#endif
-#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
-
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
// Assigns from a T (deep-moves/copies the rhs value)
@@ -1127,7 +834,7 @@ class optional
BOOST_DEDUCED_TYPENAME boost::enable_if<boost::is_same<T, BOOST_DEDUCED_TYPENAME boost::decay<T_>::type>, optional&>::type
operator= ( T_&& val )
{
- this->assign( boost::forward<T_>(val) ) ;
+ this->assign( optional_detail::forward<T_>(val) ) ;
return *this ;
}
@@ -1141,14 +848,12 @@ class optional
return *this ;
}
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Assigns from a T (deep-moves the rhs value)
optional& operator= ( rval_reference_type val )
{
- this->assign( boost::move(val) ) ;
+ this->assign( optional_detail::move(val) ) ;
return *this ;
}
-#endif
#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
@@ -1161,101 +866,24 @@ class optional
return *this ;
}
-#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
// Constructs in-place
// upon exception *this is always uninitialized
template<class... Args>
void emplace ( Args&&... args )
{
- this->emplace_assign( boost::forward<Args>(args)... );
+ this->emplace_assign( optional_detail::forward<Args>(args)... );
}
template<class... Args>
explicit optional ( in_place_init_t, Args&&... args )
- : base( in_place_init, boost::forward<Args>(args)... )
+ : base( in_place_init, optional_detail::forward<Args>(args)... )
{}
template<class... Args>
explicit optional ( in_place_init_if_t, bool cond, Args&&... args )
- : base( in_place_init_if, cond, boost::forward<Args>(args)... )
- {}
-
-#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template<class Arg>
- void emplace ( Arg&& arg )
- {
- this->emplace_assign( boost::forward<Arg>(arg) );
- }
-
- void emplace ()
- {
- this->emplace_assign();
- }
-
- template<class Args>
- explicit optional ( in_place_init_t, Args&& args )
- : base( in_place_init, boost::forward<Args>(args) )
+ : base( in_place_init_if, cond, optional_detail::forward<Args>(args)... )
{}
- explicit optional ( in_place_init_t )
- : base( in_place_init )
- {}
-
- template<class Args>
- explicit optional ( in_place_init_if_t, bool cond, Args&& args )
- : base( in_place_init_if, cond, boost::forward<Args>(args) )
- {}
-
- explicit optional ( in_place_init_if_t, bool cond )
- : base( in_place_init_if, cond )
- {}
-#else
- template<class Arg>
- void emplace ( const Arg& arg )
- {
- this->emplace_assign( arg );
- }
-
- template<class Arg>
- void emplace ( Arg& arg )
- {
- this->emplace_assign( arg );
- }
-
- void emplace ()
- {
- this->emplace_assign();
- }
-
- template<class Arg>
- explicit optional ( in_place_init_t, const Arg& arg )
- : base( in_place_init, arg )
- {}
-
- template<class Arg>
- explicit optional ( in_place_init_t, Arg& arg )
- : base( in_place_init, arg )
- {}
-
- explicit optional ( in_place_init_t )
- : base( in_place_init )
- {}
-
- template<class Arg>
- explicit optional ( in_place_init_if_t, bool cond, const Arg& arg )
- : base( in_place_init_if, cond, arg )
- {}
-
- template<class Arg>
- explicit optional ( in_place_init_if_t, bool cond, Arg& arg )
- : base( in_place_init_if, cond, arg )
- {}
-
- explicit optional ( in_place_init_if_t, bool cond )
- : base( in_place_init_if, cond )
- {}
-#endif
-
void swap( optional & arg )
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && ::boost::is_nothrow_move_assignable<T>::value)
{
@@ -1283,42 +911,14 @@ class optional
// Returns a reference to the value if this is initialized, otherwise,
// the behaviour is UNDEFINED
// No-throw
-#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- reference_const_type operator *() const& { return this->get() ; }
- reference_type operator *() & { return this->get() ; }
- reference_type_of_temporary_wrapper operator *() && { return boost::move(this->get()) ; }
-#else
- reference_const_type operator *() const { return this->get() ; }
- reference_type operator *() { return this->get() ; }
-#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
+ reference_const_type operator *() BOOST_OPTIONAL_CONST_REF_QUAL { return this->get() ; }
+ reference_type operator *() BOOST_OPTIONAL_REF_QUAL { return this->get() ; }
-#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- reference_const_type value() const&
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-
- reference_type value() &
- {
- if (this->is_initialized())
- return this->get() ;
- else
- throw_exception(bad_optional_access());
- }
-
- reference_type_of_temporary_wrapper value() &&
- {
- if (this->is_initialized())
- return boost::move(this->get()) ;
- else
- throw_exception(bad_optional_access());
- }
+#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
+ reference_type_of_temporary_wrapper operator *() && { return optional_detail::move(this->get()) ; }
+#endif
-#else
- reference_const_type value() const
+ reference_const_type value() BOOST_OPTIONAL_CONST_REF_QUAL
{
if (this->is_initialized())
return this->get() ;
@@ -1326,112 +926,64 @@ class optional
throw_exception(bad_optional_access());
}
- reference_type value()
+ reference_type value() BOOST_OPTIONAL_REF_QUAL
{
if (this->is_initialized())
return this->get() ;
else
throw_exception(bad_optional_access());
}
-#endif
-
-#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
template <class U>
- value_type value_or ( U&& v ) const&
+ value_type value_or ( U&& v ) BOOST_OPTIONAL_CONST_REF_QUAL
{
if (this->is_initialized())
return get();
else
- return boost::forward<U>(v);
+ return optional_detail::forward<U>(v);
}
- template <class U>
- value_type value_or ( U&& v ) &&
- {
- if (this->is_initialized())
- return boost::move(get());
- else
- return boost::forward<U>(v);
- }
-#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- template <class U>
- value_type value_or ( U&& v ) const
- {
- if (this->is_initialized())
- return get();
- else
- return boost::forward<U>(v);
- }
-#else
- template <class U>
- value_type value_or ( U const& v ) const
+ template <typename F>
+ value_type value_or_eval ( F f ) BOOST_OPTIONAL_CONST_REF_QUAL
{
if (this->is_initialized())
return get();
else
- return v;
+ return f();
}
- template <class U>
- value_type value_or ( U& v ) const
+#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
+ reference_type_of_temporary_wrapper value() &&
{
if (this->is_initialized())
- return get();
+ return optional_detail::move(this->get()) ;
else
- return v;
+ throw_exception(bad_optional_access());
}
-#endif
-
-#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
- template <typename F>
- value_type value_or_eval ( F f ) const&
+ template <class U>
+ value_type value_or ( U&& v ) &&
{
if (this->is_initialized())
- return get();
+ return optional_detail::move(get());
else
- return f();
+ return optional_detail::forward<U>(v);
}
template <typename F>
value_type value_or_eval ( F f ) &&
{
if (this->is_initialized())
- return boost::move(get());
+ return optional_detail::move(get());
else
return f();
}
+#endif
- template <typename F>
- optional<typename boost::result_of<F(reference_type)>::type> map(F f) &
- {
- if (this->has_value())
- return f(get());
- else
- return none;
- }
-
- template <typename F>
- optional<typename boost::result_of<F(reference_const_type)>::type> map(F f) const&
- {
- if (this->has_value())
- return f(get());
- else
- return none;
- }
-
- template <typename F>
- optional<typename boost::result_of<F(reference_type_of_temporary_wrapper)>::type> map(F f) &&
- {
- if (this->has_value())
- return f(boost::move(this->get()));
- else
- return none;
- }
+// Monadic interface
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type)>::type>::type> flat_map(F f) &
+ optional<typename optional_detail::result_of<F, reference_type>::type> map(F f) BOOST_OPTIONAL_REF_QUAL
{
if (this->has_value())
return f(get());
@@ -1440,7 +992,7 @@ class optional
}
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_const_type)>::type>::type> flat_map(F f) const&
+ optional<typename optional_detail::result_of<F, reference_const_type>::type> map(F f) BOOST_OPTIONAL_CONST_REF_QUAL
{
if (this->has_value())
return f(get());
@@ -1448,36 +1000,20 @@ class optional
return none;
}
+#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type_of_temporary_wrapper)>::type>::type> flat_map(F f) &&
- {
- if (this->has_value())
- return f(boost::move(get()));
- else
- return none;
- }
-
-#else
- template <typename F>
- value_type value_or_eval ( F f ) const
- {
- if (this->is_initialized())
- return get();
- else
- return f();
- }
-
- template <typename F>
- optional<typename boost::result_of<F(reference_type)>::type> map(F f)
+ optional<typename optional_detail::result_of<F, reference_type_of_temporary_wrapper>::type> map(F f) &&
{
if (this->has_value())
- return f(get());
+ return f(optional_detail::move(this->get()));
else
return none;
}
+#endif
template <typename F>
- optional<typename boost::result_of<F(reference_const_type)>::type> map(F f) const
+ optional<typename optional_detail::result_value_type<F, reference_type>::type>
+ flat_map(F f) BOOST_OPTIONAL_REF_QUAL
{
if (this->has_value())
return f(get());
@@ -1486,7 +1022,8 @@ class optional
}
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type)>::type>::type> flat_map(F f)
+ optional<typename optional_detail::result_value_type<F, reference_const_type>::type>
+ flat_map(F f) BOOST_OPTIONAL_CONST_REF_QUAL
{
if (this->has_value())
return f(get());
@@ -1494,37 +1031,29 @@ class optional
return none;
}
+#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
template <typename F>
- optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_const_type)>::type>::type> flat_map(F f) const
+ optional<typename optional_detail::result_value_type<F, reference_type_of_temporary_wrapper>::type>
+ flat_map(F f) &&
{
if (this->has_value())
- return f(get());
+ return f(optional_detail::move(get()));
else
return none;
}
-
#endif
bool has_value() const BOOST_NOEXCEPT { return this->is_initialized() ; }
- bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; }
-
- BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
+ explicit operator bool() const BOOST_NOEXCEPT { return this->has_value() ; }
} ;
-} // namespace boost
-
-#endif // BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL
-namespace boost {
-
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class T>
class optional<T&&>
{
- BOOST_STATIC_ASSERT_MSG(sizeof(T) == 0, "Optional rvalue references are illegal.");
+ static_assert(sizeof(T) == 0, "Optional rvalue references are illegal.");
} ;
-#endif
} // namespace boost
@@ -1534,13 +1063,12 @@ class optional<T&&>
namespace boost {
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class T>
inline
optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type> make_optional ( T && v )
{
- return optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type>(boost::forward<T>(v));
+ return optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type>(optional_detail::forward<T>(v));
}
// Returns optional<T>(cond,v)
@@ -1548,28 +1076,9 @@ template<class T>
inline
optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type> make_optional ( bool cond, T && v )
{
- return optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type>(cond,boost::forward<T>(v));
-}
-
-#else
-
-// Returns optional<T>(v)
-template<class T>
-inline
-optional<T> make_optional ( T const& v )
-{
- return optional<T>(v);
-}
-
-// Returns optional<T>(cond,v)
-template<class T>
-inline
-optional<T> make_optional ( bool cond, T const& v )
-{
- return optional<T>(cond,v);
+ return optional<BOOST_DEDUCED_TYPENAME boost::decay<T>::type>(cond,optional_detail::forward<T>(v));
}
-#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED.
// No-throw
@@ -1653,7 +1162,7 @@ template<class CharType, class CharTrait>
std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& os, optional_detail::optional_tag const&)
{
- BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
+ static_assert(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
return os;
}
diff --git a/contrib/restricted/boost/optional/include/boost/optional/optional_io.hpp b/contrib/restricted/boost/optional/include/boost/optional/optional_io.hpp
index 3db6ddae76b..85acfa17c96 100644
--- a/contrib/restricted/boost/optional/include/boost/optional/optional_io.hpp
+++ b/contrib/restricted/boost/optional/include/boost/optional/optional_io.hpp
@@ -63,11 +63,7 @@ operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
{
T x;
in >> x;
-#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
- v = boost::move(x);
-#else
- v = x;
-#endif
+ v = optional_detail::move(x);
}
else
{
diff --git a/contrib/restricted/boost/optional/ya.make b/contrib/restricted/boost/optional/ya.make
index 22161980ce6..f5fc86fbef0 100644
--- a/contrib/restricted/boost/optional/ya.make
+++ b/contrib/restricted/boost/optional/ya.make
@@ -6,21 +6,16 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.86.0)
+VERSION(1.87.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/optional/archive/boost-1.86.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/optional/archive/boost-1.87.0.tar.gz)
PEERDIR(
contrib/restricted/boost/assert
contrib/restricted/boost/config
contrib/restricted/boost/core
- contrib/restricted/boost/detail
- contrib/restricted/boost/move
- contrib/restricted/boost/predef
- contrib/restricted/boost/static_assert
contrib/restricted/boost/throw_exception
contrib/restricted/boost/type_traits
- contrib/restricted/boost/utility
)
ADDINCL(