123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef BOOST_HOF_GUARD_FUNCTION_OVERLOAD_H
- #define BOOST_HOF_GUARD_FUNCTION_OVERLOAD_H
- #include <boost/hof/reveal.hpp>
- #include <boost/hof/detail/callable_base.hpp>
- #include <boost/hof/detail/delegate.hpp>
- #include <boost/hof/detail/move.hpp>
- #include <boost/hof/detail/make.hpp>
- #include <boost/hof/detail/static_const_var.hpp>
- namespace boost { namespace hof {
- template<class...Fs> struct match_adaptor;
-
- template<class F, class...Fs>
- struct match_adaptor<F, Fs...> : detail::callable_base<F>, match_adaptor<Fs...>
- {
- typedef match_adaptor<Fs...> base;
- typedef match_adaptor fit_rewritable_tag;
- struct failure
- : failure_for<detail::callable_base<F>, Fs...>
- {};
- BOOST_HOF_INHERIT_DEFAULT(match_adaptor, detail::callable_base<F>, base);
- template<class X, class... Xs, BOOST_HOF_ENABLE_IF_CONVERTIBLE(X, detail::callable_base<F>), BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(base, Xs...)>
- constexpr match_adaptor(X&& f1, Xs&& ... fs)
- : detail::callable_base<F>(BOOST_HOF_FORWARD(X)(f1)), base(BOOST_HOF_FORWARD(Xs)(fs)...)
- {}
- using F::operator();
- using base::operator();
- };
- template<class F>
- struct match_adaptor<F> : detail::callable_base<F>
- {
- typedef detail::callable_base<F> base;
- typedef match_adaptor fit_rewritable_tag;
- using F::operator();
- BOOST_HOF_INHERIT_CONSTRUCTOR(match_adaptor, detail::callable_base<F>);
- };
- BOOST_HOF_DECLARE_STATIC_VAR(match, detail::make<match_adaptor>);
- }}
- #endif
|