/*============================================================================= Copyright (c) 2006 Joel de Guzman Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_OVERLOAD_06162006_2345) #define BOOST_OVERLOAD_06162006_2345 #include #include namespace boost { struct final_overload_function { struct final; static int const index = -1; void operator()(final*) const {} }; template struct overload_function; template struct overload_function : Base { using Base::operator(); static int const index = Base::index + 1; R operator()() const { return get(static_cast(this)->functions)(); } }; template struct overload_function : Base { using Base::operator(); static int const index = Base::index + 1; R operator()(A0 a0) const { return get(static_cast(this)->functions)(a0); } }; template struct overload_function : Base { using Base::operator(); static int const index = Base::index + 1; R operator()(A0 a0, A1 a1) const { return get(static_cast(this)->functions)(a0, a1); } }; template struct overload_function : Base { using Base::operator(); static int const index = Base::index + 1; R operator()(A0 a0, A1 a1, A2 a2) const { return get(static_cast(this)->functions)(a0, a1, a2); } }; template struct overload; namespace detail { template struct compose_overload_base { typedef overload derived; typedef overload_function ov1; typedef overload_function ov2; typedef overload_function ov3; typedef overload_function ov4; typedef ov4 type; }; } template struct overload : detail::compose_overload_base::type { typedef tuple< boost::function , boost::function , boost::function , boost::function > functions_type; template void set(F const& f) { get(functions) = f; } functions_type functions; }; } #endif