
AMDG Ruediger Berlich wrote:
is it possible to get direct access to a function object encapsulated in boost::function ?
If you know that type of the function object, you can use target.
And is it possible to determine whether boost::function has indeed stored a function object rather than, say, a function pointer ?
You can get the typeid of the type that a boost::function contains using the function target_type. #include <iostream> #include <boost/function.hpp> void f() { std::cout << "Calling f" << std::endl; } int main() { boost::function<void()> func = &f; if(func.target_type() == typeid(void(*)())) { func(); } if(void(**target)() = func.target<void(*)()>()) { (*target)(); } } In Christ, Steven Watanabe