Ticket #7418: boost-move-1.53.diff

File boost-move-1.53.diff, 1.5 KB (added by KaiSt <k.stuhlemmer@…>, 9 years ago)

Extending boost/move by macro BOOST_RV_REF_WRAPPER() for safer usage. Patch has been created against Boost 1.53

  • boost/move/core.hpp

     
    5050      void operator=(rv const&);
    5151   } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS;
    5252
     53   //////////////////////////////////////////////////////////////////////////////
     54   //
     55   //                            struct rv_wrapper
     56   //
     57   //////////////////////////////////////////////////////////////////////////////
     58   template <class T>
     59   class rv_wrapper
     60   {
     61     ::boost::rv<T>& ref_;
     62      public:
     63         rv_wrapper(::boost::rv<T>& iref) : ref_(iref) {}
     64         operator ::boost::rv<T>& () { return ref_; }
     65   };
    5366
    5467   //////////////////////////////////////////////////////////////////////////////
    5568   //
     
    118131      >& \
    119132   //
    120133
     134   #define BOOST_RV_REF_WRAPPER(TYPE)\
     135      ::boost::rv_wrapper< TYPE >
     136
    121137   #define BOOST_FWD_REF(TYPE)\
    122138      const TYPE & \
    123139   //
     
    269285      const TYPE & \
    270286   //
    271287
     288   //!This macro is used to achieve portable syntax in move
     289   //!constructors and assignments for classes marked as
     290   //!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE
     291   //!It should be used in order to avoid implicit conversion of a
     292   //!type into boost::rv<type>.
     293   #define BOOST_RV_REF_WRAPPER(TYPE)\
     294      BOOST_RV_REF( TYPE )
     295
    272296   //! This macro is used to implement portable perfect forwarding
    273297   //! as explained in the documentation.
    274298   #define BOOST_FWD_REF(TYPE)\