diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
commit | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/spirit/home/support/detail/hold_any.hpp | |
parent | bb4dd8289b351fae6b55e303f189127a394a1edd (diff) | |
download | boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2 boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip |
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/spirit/home/support/detail/hold_any.hpp')
-rw-r--r-- | boost/spirit/home/support/detail/hold_any.hpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/boost/spirit/home/support/detail/hold_any.hpp b/boost/spirit/home/support/detail/hold_any.hpp index 4332fa2c08..f9a3ff1bfa 100644 --- a/boost/spirit/home/support/detail/hold_any.hpp +++ b/boost/spirit/home/support/detail/hold_any.hpp @@ -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)); } |