From ae15fc54b2d9ff2c4845d6ee688e2100038cfc24 Mon Sep 17 00:00:00 2001 From: typenameTea Date: Thu, 19 Sep 2024 22:14:24 +0100 Subject: [PATCH] refactor: add back unified init syntax conditional --- include/boost/optional/optional.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index b755d91..37b5c35 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -838,7 +838,7 @@ class optional } #endif - +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // Assigns from a T (deep-moves/copies the rhs value) template @@ -849,6 +849,24 @@ class optional return *this ; } +#else + + // 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 ; + } + + // Assigns from a T (deep-moves the rhs value) + optional& operator= ( rval_reference_type val ) + { + this->assign( boost::move(val) ) ; + return *this ; + } + +#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // Assigns from a "none" // Which destroys the current value, if any, leaving this UNINITIALIZED