]> git.lyx.org Git - lyx.git/blobdiff - 3rdparty/boost/boost/variant/variant.hpp
Update to boost 1.72
[lyx.git] / 3rdparty / boost / boost / variant / variant.hpp
index d33a23e4771557cba76522cb73587b3fae51b2b0..8be5a6da389a027a8468d85cd7c30a33ef509725 100644 (file)
@@ -4,7 +4,7 @@
 //-----------------------------------------------------------------------------
 //
 // Copyright (c) 2002-2003 Eric Friedman, Itay Maman
-// Copyright (c) 2012-2016 Antony Polukhin
+// Copyright (c) 2012-2019 Antony Polukhin
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -32,8 +32,8 @@
 #include <boost/variant/detail/over_sequence.hpp>
 #include <boost/variant/detail/visitation_impl.hpp>
 #include <boost/variant/detail/hash_variant.hpp>
+#include <boost/variant/detail/std_hash.hpp>
 
-#include <boost/variant/detail/generic_result_type.hpp>
 #include <boost/variant/detail/move.hpp>
 
 #include <boost/detail/no_exceptions_support.hpp>
@@ -381,8 +381,7 @@ struct destroyer
 public: // visitor interfaces
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(T& operand, int) const BOOST_NOEXCEPT
+    void internal_visit(T& operand, int) const BOOST_NOEXCEPT
     {
         operand.~T(); // must be noexcept
 
@@ -390,8 +389,6 @@ public: // visitor interfaces
     BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
         (void)operand; // suppresses warnings
 #endif
-
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
 };
@@ -445,27 +442,21 @@ public: // structors
 public: // internal visitor interface
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
+    void internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
     {
         new(storage_) T( operand.get() );
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const
+    void internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const
     {
         new(storage_) T( operand.get() );
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(const T& operand, int) const
+    void internal_visit(const T& operand, int) const
     {
         new(storage_) T(operand);
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
 };
@@ -493,19 +484,15 @@ public: // structors
 public: // internal visitor interface
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
+    void internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const
     {
         new(storage_) T( ::boost::detail::variant::move(operand.get()) );
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(T& operand, int) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(T(boost::declval<T>())))
+    void internal_visit(T& operand, int) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(T(boost::declval<T>())))
     {
         new(storage_) T(::boost::detail::variant::move(operand));
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 };
 #endif
@@ -533,26 +520,21 @@ public: // structors
 public: // internal visitor interfaces
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(backup_holder<T>& lhs_content, long) const
+    void internal_visit(backup_holder<T>& lhs_content, long) const
     {
         lhs_content.get()
             = static_cast< const backup_holder<T>* >(rhs_storage_)->get();
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(const backup_holder<T>& lhs_content, long) const
+    void internal_visit(const backup_holder<T>& lhs_content, long) const
     {
         lhs_content.get()
             = static_cast< const backup_holder<T>* >(rhs_storage_)->get();
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(T& lhs_content, int) const
+    void internal_visit(T& lhs_content, int) const
     {
         // NOTE TO USER :
         // Compile error here indicates one of variant's bounded types does
@@ -562,7 +544,6 @@ public: // internal visitor interfaces
         // Hint: Are any of the bounded types const-qualified or references?
         //
         lhs_content = *static_cast< const T* >(rhs_storage_);
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
 };
@@ -590,26 +571,21 @@ public: // structors
 public: // internal visitor interfaces
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(backup_holder<T>& lhs_content, long) const
+    void internal_visit(backup_holder<T>& lhs_content, long) const
     {
         lhs_content.get()
             = ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get());
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(const backup_holder<T>& lhs_content, long) const
+    void internal_visit(const backup_holder<T>& lhs_content, long) const
     {
         lhs_content.get()
             = ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get());
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(T& lhs_content, int) const
+    void internal_visit(T& lhs_content, int) const
     {
         // NOTE TO USER :
         // Compile error here indicates one of variant's bounded types does
@@ -619,7 +595,6 @@ public: // internal visitor interfaces
         // Hint: Are any of the bounded types const-qualified or references?
         //
         lhs_content = ::boost::detail::variant::move(*static_cast<T* >(rhs_storage_));
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
 };
@@ -866,15 +841,12 @@ private: // helpers, for visitor interface (below)
 public: // visitor interface
 
     template <typename LhsT>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    internal_visit(LhsT& lhs_content, int)
+    void internal_visit(LhsT& lhs_content, int)
     {
         typedef typename is_nothrow_move_constructible<LhsT>::type
             nothrow_move;
 
         backup_assign_impl( lhs_content, nothrow_move(), 1L);
-
-        BOOST_VARIANT_AUX_RETURN_VOID;
     }
 
 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -1038,8 +1010,6 @@ public: // structors
     {
     }
 
-#if !defined(BOOST_NO_VOID_RETURNS)
-
 public: // internal visitor interfaces
 
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
@@ -1076,119 +1046,40 @@ public: // internal visitor interfaces
 
 #endif //RVALUE REFERENCES
 
-#else // defined(BOOST_NO_VOID_RETURNS)
-
-private: // helpers, for internal visitor interfaces (below)
-
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-
-    //using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
-    template <typename T>
-        typename enable_if<mpl::and_<MoveSemantics && is_same<T, T>::value>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
-    visit_impl(T&& operand, mpl::false_)
-    {
-        return visitor_(::boost::move(operand));
-    }
-
-    //using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
-    template <typename T>
-        typename enable_if_c<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type
-    visit_impl(T&& operand, mpl::true_)
-    {
-        visitor_(::boost::move(operand));
-        BOOST_VARIANT_AUX_RETURN_VOID;
-    }
-
-    //using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
-    template <typename T>
-        typename disable_if_c<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type
-    visit_impl(T&& operand, mpl::false_)
-    {
-        return visitor_(operand);
-    }
-
-    //using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
-    template <typename T>
-        typename disable_if<MoveSemantics && is_same<T, T>::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type
-    visit_impl(T&& operand, mpl::true_)
-    {
-        visitor_(operand);
-        BOOST_VARIANT_AUX_RETURN_VOID;
-    }
-
-#else
-
-    template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    visit_impl(T& operand, mpl::false_)
-    {
-        return visitor_(operand);
-    }
-
-    template <typename T>
-        BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-    visit_impl(T& operand, mpl::true_)
-    {
-        visitor_(operand);
-        BOOST_VARIANT_AUX_RETURN_VOID;
-    }
-
-#endif //RVALUE_REFERENCES
-
-public: // internal visitor interfaces
-
-    template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(T& operand, int)
-    {
-        typedef typename is_same<result_type, void>::type
-            has_void_result_type;
-
-        return visit_impl(operand, has_void_result_type());
-    }
-
-#endif // BOOST_NO_VOID_RETURNS) workaround
-
 public: // internal visitor interfaces, cont.
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(boost::recursive_wrapper<T>& operand, long)
+    result_type internal_visit(boost::recursive_wrapper<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(const boost::recursive_wrapper<T>& operand, long)
+    result_type internal_visit(const boost::recursive_wrapper<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(boost::detail::reference_content<T>& operand, long)
+    result_type internal_visit(boost::detail::reference_content<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(const boost::detail::reference_content<T>& operand, long)
+    result_type internal_visit(const boost::detail::reference_content<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(boost::detail::variant::backup_holder<T>& operand, long)
+    result_type internal_visit(boost::detail::variant::backup_holder<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
 
     template <typename T>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
-    internal_visit(const boost::detail::variant::backup_holder<T>& operand, long)
+    result_type internal_visit(const boost::detail::variant::backup_holder<T>& operand, long)
     {
         return internal_visit( operand.get(), 1L );
     }
@@ -2013,8 +1904,7 @@ private: // helpers, for modifiers (below)
     public: // internal visitor interfaces
 
         template <typename RhsT>
-            BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-        internal_visit(const RhsT& rhs_content, int) const
+        void internal_visit(const RhsT& rhs_content, int) const
         {
             typedef typename has_nothrow_copy<RhsT>::type
                 nothrow_copy;
@@ -2029,8 +1919,6 @@ private: // helpers, for modifiers (below)
                 , nothrow_move_constructor()
                 , has_fallback_type_()
                 );
-
-            BOOST_VARIANT_AUX_RETURN_VOID;
         }
 
 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -2135,8 +2023,7 @@ private: // helpers, for modifiers (below)
     public: // internal visitor interfaces
 
         template <typename RhsT>
-            BOOST_VARIANT_AUX_RETURN_VOID_TYPE
-        internal_visit(RhsT& rhs_content, int) const
+        void internal_visit(RhsT& rhs_content, int) const
         {
             typedef typename is_nothrow_move_constructible<RhsT>::type
                 nothrow_move_constructor;
@@ -2151,8 +2038,6 @@ private: // helpers, for modifiers (below)
                 , nothrow_move_constructor()
                 , has_fallback_type_()
                 );
-
-            BOOST_VARIANT_AUX_RETURN_VOID;
         }
 
 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
@@ -2430,10 +2315,7 @@ public:
 #endif// !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
 
     template <typename Visitor, typename VoidPtrCV>
-    static
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    BOOST_FORCEINLINE static typename Visitor::result_type
     internal_apply_visitor_impl(
           int internal_which
         , int logical_which
@@ -2458,9 +2340,7 @@ public:
     }
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    BOOST_FORCEINLINE typename Visitor::result_type
     internal_apply_visitor(Visitor& visitor)
     {
         return internal_apply_visitor_impl(
@@ -2469,9 +2349,7 @@ public:
     }
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    BOOST_FORCEINLINE typename Visitor::result_type
     internal_apply_visitor(Visitor& visitor) const
     {
         return internal_apply_visitor_impl(
@@ -2484,9 +2362,7 @@ public: // visitation support
 #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    typename Visitor::result_type
     apply_visitor(Visitor& visitor) &&
     {
         detail::variant::invoke_visitor<Visitor, true> invoker(visitor);
@@ -2494,9 +2370,7 @@ public: // visitation support
     }
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    typename Visitor::result_type
     apply_visitor(Visitor& visitor) const&&
     {
         detail::variant::invoke_visitor<Visitor, true> invoker(visitor);
@@ -2506,9 +2380,7 @@ public: // visitation support
 #endif
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    typename Visitor::result_type
     apply_visitor(Visitor& visitor)
 #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
     &
@@ -2519,9 +2391,7 @@ public: // visitation support
     }
 
     template <typename Visitor>
-        BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
-              typename Visitor::result_type
-            )
+    typename Visitor::result_type
     apply_visitor(Visitor& visitor) const
 #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
     &