}
static void move(void* const* src, void** dest)
{
- reinterpret_cast<T*>(dest)->~T();
*reinterpret_cast<T*>(dest) =
*reinterpret_cast<T const*>(src);
}
}
static void move(void* const* src, void** dest)
{
- (*reinterpret_cast<T**>(dest))->~T();
**reinterpret_cast<T**>(dest) =
**reinterpret_cast<T* const*>(src);
}
}
// 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)
{
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)
{
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));
}