Re: [Boost-bugs] [Boost C++ Libraries] #12307: Copy assignment from const ref handled differently in C++11/C++98

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12307: Copy assignment from const ref handled differently in C++11/C++98
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-06-30 11:43:10


#12307: Copy assignment from const ref handled differently in C++11/C++98
-------------------------------+------------------------
  Reporter: a.grund@… | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: move
   Version: Boost 1.59.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+------------------------

Comment (by a.grund@…):

 I guessed that. But it is not documented and the current documentation
 statest that this should be possible:
 http://www.boost.org/doc/libs/1_61_0/doc/html/move/how_the_library_works.html
 ("const rvalue and lvalues, bind to const ::boost::rv< TYPE >&")

 My first guess for a fix would be based on:


 {{{
    #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
       public:\
       TYPE& operator=(TYPE &t)\
       { this->operator=(*BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*,
 &t)); return *this;}\
 }}}

 so what about:

 {{{
    #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
       public:\
       TYPE& operator=(TYPE &t)\
       { this->operator=(*BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*,
 &t)); return *this;}\
       const TYPE& operator=(const TYPE &t)\
       { this->operator=(*BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*,
 &t)); return *this;}\
 }}}

 or similar. Not sure if this works for all cases or at all, but this would
 fulfill the "const lvalues bind to const rv&" part.

 If this does not work, please add it to the docu.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12307#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC