Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / spirit / home / support / detail / hold_any.hpp
index 4332fa2..f9a3ff1 100644 (file)
@@ -98,7 +98,6 @@ namespace boost { namespace spirit
                 }
                 static void move(void* const* src, void** dest)
                 {
-                    reinterpret_cast<T*>(dest)->~T();
                     *reinterpret_cast<T*>(dest) =
                         *reinterpret_cast<T const*>(src);
                 }
@@ -144,7 +143,6 @@ namespace boost { namespace spirit
                 }
                 static void move(void* const* src, void** dest)
                 {
-                    (*reinterpret_cast<T**>(dest))->~T();
                     **reinterpret_cast<T**>(dest) =
                         **reinterpret_cast<T* const*>(src);
                 }
@@ -300,11 +298,25 @@ namespace boost { namespace spirit
         }
 
         // assignment operator
+#ifdef BOOST_HAS_RVALUE_REFS
+        template <typename T>
+        basic_hold_any& operator=(T&& x)
+        {
+            return assign(std::forward<T>(x));
+        }
+#else
+        template <typename T>
+        basic_hold_any& operator=(T& x)
+        {
+            return assign(x);
+        }
+
         template <typename T>
         basic_hold_any& operator=(T const& x)
         {
             return assign(x);
         }
+#endif
 
         // utility functions
         basic_hold_any& swap(basic_hold_any& x)
@@ -405,15 +417,6 @@ namespace boost { namespace spirit
     {
         typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type nonref;
 
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-        // If 'nonref' is still reference type, it means the user has not
-        // specialized 'remove_reference'.
-
-        // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
-        // to generate specialization of remove_reference for your class
-        // See type traits library documentation for details
-        BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
-#endif
 
         nonref* result = any_cast<nonref>(&operand);
         if(!result)
@@ -426,11 +429,6 @@ namespace boost { namespace spirit
     {
         typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type nonref;
 
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-        // The comment in the above version of 'any_cast' explains when this
-        // assert is fired and what to do.
-        BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
-#endif
 
         return any_cast<nonref const&>(const_cast<basic_hold_any<Char> &>(operand));
     }