Restore support for compilers without ref qualifiers

This commit is contained in:
Andrzej Krzemienski
2024-10-16 22:51:06 +02:00
parent c8bd18d6de
commit b2c7f93ead
4 changed files with 60 additions and 46 deletions
@@ -16,7 +16,7 @@
#include <boost/config.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
@@ -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
@@ -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 {} ;