forked from boostorg/function
merged from trunk
[SVN r48673]
This commit is contained in:
@@ -516,11 +516,9 @@ namespace boost {
|
||||
function_buffer& functor, function_obj_ref_tag)
|
||||
{
|
||||
if (!boost::detail::function::has_empty_target(f.get_pointer())) {
|
||||
// DPG TBD: We might need to detect constness of
|
||||
// FunctionObj to assign into obj_ptr or const_obj_ptr to
|
||||
// be truly legit, but no platform in existence makes
|
||||
// const void* different from void*.
|
||||
functor.const_obj_ptr = f.get_pointer();
|
||||
functor.obj_ref.obj_ptr = (void *)f.get_pointer();
|
||||
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
|
||||
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -729,9 +727,10 @@ namespace boost {
|
||||
if (&other == this)
|
||||
return;
|
||||
|
||||
BOOST_FUNCTION_FUNCTION tmp = *this;
|
||||
*this = other;
|
||||
other = tmp;
|
||||
BOOST_FUNCTION_FUNCTION tmp;
|
||||
tmp.move_assign(*this);
|
||||
this->move_assign(other);
|
||||
other.move_assign(tmp);
|
||||
}
|
||||
|
||||
// Clear out a target, if there is one
|
||||
@@ -786,6 +785,33 @@ namespace boost {
|
||||
if (stored_vtable.assign_to_a(f, functor, a)) vtable = &stored_vtable;
|
||||
else vtable = 0;
|
||||
}
|
||||
|
||||
// Moves the value from the specified argument to *this. If the argument
|
||||
// has its function object allocated on the heap, move_assign will pass
|
||||
// its buffer to *this, and set the argument's buffer pointer to NULL.
|
||||
void move_assign(BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
if (&f == this)
|
||||
return;
|
||||
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
try {
|
||||
#endif
|
||||
if (!f.empty()) {
|
||||
this->vtable = f.vtable;
|
||||
f.vtable->manager(f.functor, this->functor,
|
||||
boost::detail::function::move_functor_tag);
|
||||
f.vtable = 0;
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
} else {
|
||||
clear();
|
||||
}
|
||||
} catch (...) {
|
||||
vtable = 0;
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||
|
||||
Reference in New Issue
Block a user