Registering all types so Boost.Functional/OverloadedFunction works in type-of emulation mode (and not just native).

[SVN r77709]
This commit is contained in:
Lorenzo Caminiti
2012-04-02 01:08:20 +00:00
parent b2dd5d8ac5
commit 1326990a7e
6 changed files with 40 additions and 27 deletions
@@ -14,6 +14,7 @@
# include <boost/functional/overloaded_function/detail/base.hpp>
# include <boost/functional/overloaded_function/detail/function_type.hpp>
# include <boost/functional/overloaded_function/config.hpp>
# include <boost/typeof/typeof.hpp>
# include <boost/preprocessor/iteration/iterate.hpp>
# include <boost/preprocessor/repetition/enum.hpp>
# include <boost/preprocessor/repetition/repeat.hpp>
@@ -81,8 +82,6 @@
BOOST_FUNCTIONAL_f_type(z, n, ~) \
>::type
namespace boost {
// Iterate within namespace.
# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PP_SUB( /*at least 2 func to overload 2, 3, ...*/\
@@ -90,8 +89,6 @@ namespace boost {
"boost/functional/overloaded_function.hpp"))
# include BOOST_PP_ITERATE() // Iterate over function arity.
} // namespace
#undef BOOST_FUNCTIONAL_f_type
#undef BOOST_FUNCTIONAL_f_arg
#undef BOOST_FUNCTIONAL_f_tparam
@@ -119,6 +116,11 @@ namespace boost {
BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \
BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX)
// For type-of emulation: This must be included at this pp iteration level.
# include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
namespace boost {
template<
BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt,
BOOST_FUNCTIONAL_is_tspec)
@@ -165,6 +167,12 @@ overloaded_function<
>(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~));
}
} // namespace
// For type-of emulation: Register overloaded function type (for _AUTO, etc).
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::overloaded_function,
BOOST_FUNCTIONAL_overloads)
# undef BOOST_FUNCTIONAL_overloads
# undef BOOST_FUNCTIONAL_is_tspec
#endif // iteration