ext/boost/function/function_template.hpp in passenger-3.9.1.beta vs ext/boost/function/function_template.hpp in passenger-3.9.2.beta

- old
+ new

@@ -746,11 +746,18 @@ BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() { this->assign_to_own(f); } - + +#ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() + { + this->move_assign(f); + } +#endif + ~BOOST_FUNCTION_FUNCTION() { clear(); } result_type operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) @@ -828,11 +835,31 @@ BOOST_RETHROW; } BOOST_CATCH_END return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) + { + + if (&f == this) + return *this; + this->clear(); + BOOST_TRY { + this->move_assign(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } +#endif + void swap(BOOST_FUNCTION_FUNCTION& other) { if (&other == this) return; @@ -1061,16 +1088,30 @@ function(const self_type& f) : base_type(static_cast<const base_type&>(f)){} function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move constructors + function(self_type&& f): base_type(static_cast<base_type&&>(f)){} + function(base_type&& f): base_type(static_cast<base_type&&>(f)){} +#endif + self_type& operator=(const self_type& f) { self_type(f).swap(*this); return *this; } +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(self_type&& f) + { + self_type(static_cast<self_type&&>(f)).swap(*this); + return *this; + } +#endif + template<typename Functor> #ifndef BOOST_NO_SFINAE typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), @@ -1095,9 +1136,17 @@ self_type& operator=(const base_type& f) { self_type(f).swap(*this); return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(base_type&& f) + { + self_type(static_cast<base_type&&>(f)).swap(*this); + return *this; + } +#endif }; #undef BOOST_FUNCTION_PARTIAL_SPEC #endif // have partial specialization