Ticket #7330: function_template.hpp.diff

File function_template.hpp.diff, 2.1 KB (added by Antony Polukhin, 10 years ago)
  • function/function_template.hpp

     
    748748    {
    749749      this->assign_to_own(f);
    750750    }
    751 
     751   
     752#ifndef BOOST_NO_RVALUE_REFERENCES
     753    BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base()
     754    {
     755      this->move_assign(f);
     756    }
     757#endif
     758   
    752759    ~BOOST_FUNCTION_FUNCTION() { clear(); }
    753760
    754761    result_type operator()(BOOST_FUNCTION_PARMS) const
     
    830837      BOOST_CATCH_END
    831838      return *this;
    832839    }
     840   
     841#ifndef BOOST_NO_RVALUE_REFERENCES
     842    // Move assignment from another BOOST_FUNCTION_FUNCTION
     843    BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f)
     844    {
     845     
     846      if (&f == this)
     847        return *this;
    833848
     849      this->clear();
     850      BOOST_TRY {
     851        this->move_assign(f);
     852      } BOOST_CATCH (...) {
     853        vtable = 0;
     854        BOOST_RETHROW;
     855      }
     856      BOOST_CATCH_END
     857      return *this;
     858    }
     859#endif
     860
    834861    void swap(BOOST_FUNCTION_FUNCTION& other)
    835862    {
    836863      if (&other == this)
     
    10631090
    10641091  function(const base_type& f) : base_type(static_cast<const base_type&>(f)){}
    10651092
     1093#ifndef BOOST_NO_RVALUE_REFERENCES
     1094  // Move constructors
     1095  function(self_type&& f): base_type(static_cast<base_type&&>(f)){}
     1096  function(base_type&& f): base_type(static_cast<base_type&&>(f)){}
     1097#endif
     1098 
    10661099  self_type& operator=(const self_type& f)
    10671100  {
    10681101    self_type(f).swap(*this);
    10691102    return *this;
    10701103  }
    10711104
     1105#ifndef BOOST_NO_RVALUE_REFERENCES
     1106  self_type& operator=(self_type&& f)
     1107  {
     1108    self_type(static_cast<self_type&&>(f)).swap(*this);
     1109    return *this;
     1110  }
     1111#endif 
     1112
    10721113  template<typename Functor>
    10731114#ifndef BOOST_NO_SFINAE
    10741115  typename enable_if_c<
     
    10971138    self_type(f).swap(*this);
    10981139    return *this;
    10991140  }
     1141 
     1142#ifndef BOOST_NO_RVALUE_REFERENCES
     1143  self_type& operator=(base_type&& f)
     1144  {
     1145    self_type(static_cast<base_type&&>(f)).swap(*this);
     1146    return *this;
     1147  }
     1148#endif
    11001149};
    11011150
    11021151#undef BOOST_FUNCTION_PARTIAL_SPEC