|
Boost : |
Subject: [boost] [move] Declarations of the copy constructor and copy-assign operator produced by BOOST_MOVABLE_BUT_NOT_COPYABLE
From: Joseph Trebbien (jtrebbien_at_[hidden])
Date: 2011-04-14 12:23:37
Looking through the sources of Boost.Move in trunk, I am wondering
about a couple of lines in <boost/move/move.hpp> that are part of the
expansion of BOOST_MOVABLE_BUT_NOT_COPYABLE when
BOOST_NO_RVALUE_REFERENCES is defined:
#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
private:\
TYPE(TYPE &);\
TYPE& operator=(TYPE &);\
public:\
operator ::boost::rv<TYPE>&() \
{ return *static_cast< ::boost::rv<TYPE>* >(this); }\
operator const ::boost::rv<TYPE>&() const \
{ return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
Why do the declarations of the copy constructor and copy-assign
operator overload not take a const-reference to TYPE? When
BOOST_NO_RVALUE_REFERENCES is not defined, they do:
#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
public:\
typedef int boost_move_emulation_t;\
private:\
TYPE(const TYPE &);\
TYPE& operator=(const TYPE &);\
//
Joseph Trebbien
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk