diff --git a/include/boost/functional/overloaded_function/detail/function_type.hpp b/include/boost/functional/overloaded_function/detail/function_type.hpp index 4169ee9..0c28607 100644 --- a/include/boost/functional/overloaded_function/detail/function_type.hpp +++ b/include/boost/functional/overloaded_function/detail/function_type.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,15 @@ public: type; }; +// NOTE: When using boost::function in Boost.Typeof emulation mode, the user +// has to register boost::functionN instead of boost::function in oder to +// do TYPEOF(F::operator()). That is confusing, so boost::function is handled +// separately so it does not require any Boost.Typeof registration at all. +template +struct functor_type< boost::function > { + typedef F type; +}; + // Requires: F is a function type, pointer, reference, or monomorphic functor. // Returns: F's function type `result_type (arg1_type, arg2_type, ...)`. template @@ -61,7 +71,7 @@ struct function_type { typename boost::mpl::if_, boost::remove_reference - , // Requires, it's a functor. + , // Else, requires that F is a functor. functor_type >::type >::type diff --git a/overloaded_function/test/identity.hpp b/overloaded_function/test/identity.hpp index a1419f5..6602152 100644 --- a/overloaded_function/test/identity.hpp +++ b/overloaded_function/test/identity.hpp @@ -19,13 +19,6 @@ int (&identity_i)(int) = identity_i_impl; // Function reference. double identity_d_impl(double x) { return x; } boost::function identity_d = identity_d_impl; // Functor. - -// For type-of emulation on compilers without native type-of. -#include -#include -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1) -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // Also `functionN`. //] #endif // #include guard diff --git a/overloaded_function/test/make_decl.cpp b/overloaded_function/test/make_decl.cpp index 919b77b..7aae187 100644 --- a/overloaded_function/test/make_decl.cpp +++ b/overloaded_function/test/make_decl.cpp @@ -7,6 +7,8 @@ #include "identity.hpp" #include +#include // For `BOOST_AUTO`. +#include // No need to register `boost::function`. #include int main() {