File indexing completed on 2025-01-30 09:43:51
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_HOF_GUARD_FUNCTION_OVERLOAD_H
0009 #define BOOST_HOF_GUARD_FUNCTION_OVERLOAD_H
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 #include <boost/hof/reveal.hpp>
0076 #include <boost/hof/detail/callable_base.hpp>
0077 #include <boost/hof/detail/delegate.hpp>
0078 #include <boost/hof/detail/move.hpp>
0079 #include <boost/hof/detail/make.hpp>
0080 #include <boost/hof/detail/static_const_var.hpp>
0081
0082 namespace boost { namespace hof {
0083
0084 template<class...Fs> struct match_adaptor;
0085
0086 template<class F, class...Fs>
0087 struct match_adaptor<F, Fs...> : detail::callable_base<F>, match_adaptor<Fs...>
0088 {
0089 typedef match_adaptor<Fs...> base;
0090 typedef match_adaptor fit_rewritable_tag;
0091
0092 struct failure
0093 : failure_for<detail::callable_base<F>, Fs...>
0094 {};
0095
0096 BOOST_HOF_INHERIT_DEFAULT(match_adaptor, detail::callable_base<F>, base);
0097
0098 template<class X, class... Xs, BOOST_HOF_ENABLE_IF_CONVERTIBLE(X, detail::callable_base<F>), BOOST_HOF_ENABLE_IF_CONSTRUCTIBLE(base, Xs...)>
0099 constexpr match_adaptor(X&& f1, Xs&& ... fs)
0100 : detail::callable_base<F>(BOOST_HOF_FORWARD(X)(f1)), base(BOOST_HOF_FORWARD(Xs)(fs)...)
0101 {}
0102
0103 using F::operator();
0104 using base::operator();
0105 };
0106
0107 template<class F>
0108 struct match_adaptor<F> : detail::callable_base<F>
0109 {
0110 typedef detail::callable_base<F> base;
0111 typedef match_adaptor fit_rewritable_tag;
0112 using F::operator();
0113
0114 BOOST_HOF_INHERIT_CONSTRUCTOR(match_adaptor, detail::callable_base<F>);
0115 };
0116
0117 BOOST_HOF_DECLARE_STATIC_VAR(match, detail::make<match_adaptor>);
0118
0119 }}
0120
0121 #endif