From 7c1dcd51f6c4931ac3f446cb50e9c6b84e47baa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 15 Jan 2012 12:25:12 +0000 Subject: [PATCH] Ticket #6396: Implicit instanciation of boost::rv for non-cass types generates an error [SVN r76509] --- include/boost/move/move.hpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/boost/move/move.hpp b/include/boost/move/move.hpp index 284c58e..4d510f4 100644 --- a/include/boost/move/move.hpp +++ b/include/boost/move/move.hpp @@ -225,13 +225,32 @@ namespace boost { + namespace move_detail { + template + struct is_class_or_union + { + struct twochar { char _[2]; }; + template + static char is_class_or_union_tester(void(U::*)(void)); + template + static twochar is_class_or_union_tester(...); + static const bool value = sizeof(is_class_or_union_tester(0)) == sizeof(char); + }; + struct empty{}; + } + ////////////////////////////////////////////////////////////////////////////// // // struct rv // ////////////////////////////////////////////////////////////////////////////// template - class rv : public T + class rv + : public BOOST_MOVE_MPL_NS::if_c + < ::boost::move_detail::is_class_or_union::value + , T + , ::boost::move_detail::empty + >::type { rv(); ~rv(); @@ -239,6 +258,8 @@ void operator=(rv const&); } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; + + ////////////////////////////////////////////////////////////////////////////// // // move_detail::is_rv