Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76509 - branches/release/boost/move
From: igaztanaga_at_[hidden]
Date: 2012-01-15 07:25:13


Author: igaztanaga
Date: 2012-01-15 07:25:12 EST (Sun, 15 Jan 2012)
New Revision: 76509
URL: http://svn.boost.org/trac/boost/changeset/76509

Log:
Ticket #6396: Implicit instanciation of boost::rv for non-cass types generates an error
Text files modified:
   branches/release/boost/move/move.hpp | 23 ++++++++++++++++++++++-
   1 files changed, 22 insertions(+), 1 deletions(-)

Modified: branches/release/boost/move/move.hpp
==============================================================================
--- branches/release/boost/move/move.hpp (original)
+++ branches/release/boost/move/move.hpp 2012-01-15 07:25:12 EST (Sun, 15 Jan 2012)
@@ -225,13 +225,32 @@
 
    namespace boost {
 
+ namespace move_detail {
+ template<class T>
+ struct is_class_or_union
+ {
+ struct twochar { char _[2]; };
+ template <class U>
+ static char is_class_or_union_tester(void(U::*)(void));
+ template <class U>
+ static twochar is_class_or_union_tester(...);
+ static const bool value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(char);
+ };
+ struct empty{};
+ }
+
    //////////////////////////////////////////////////////////////////////////////
    //
    // struct rv
    //
    //////////////////////////////////////////////////////////////////////////////
    template <class T>
- class rv : public T
+ class rv
+ : public BOOST_MOVE_MPL_NS::if_c
+ < ::boost::move_detail::is_class_or_union<T>::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


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk