function_base.hpp:

- Add trivial_manager that does nothing but copy object pointers
  - Add is_ref to determine if a type is a reference_wrapper
  - Add function_obj_ref_tag for reference_wrappers
  - Teach get_function_tag about reference_wrappers

function_template.hpp:
  - Add assign_to overload for reference_wrappers (these don't throw)


[SVN r11875]
This commit is contained in:
Douglas Gregor
2001-12-03 16:28:33 +00:00
parent 2e67e2126b
commit 8cbd121969
2 changed files with 71 additions and 2 deletions

View File

@ -391,6 +391,28 @@ namespace boost {
}
}
template<typename FunctionObj>
void assign_to(const reference_wrapper<FunctionObj>& f,
detail::function::function_obj_ref_tag)
{
if (!detail::function::has_empty_target(&f.get())) {
typedef
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
FunctionObj,
R BOOST_FUNCTION_COMMA
BOOST_FUNCTION_TEMPLATE_ARGS
>::type
invoker_type;
invoker = &invoker_type::invoke;
manager = &detail::function::trivial_manager;
functor =
manager(detail::function::any_pointer(
const_cast<FunctionObj*>(&f.get())),
detail::function::clone_functor_tag);
}
}
typedef result_type (*invoker_type)(detail::function::any_pointer
BOOST_FUNCTION_COMMA
BOOST_FUNCTION_TEMPLATE_ARGS);