Warning, file /include/boost/phoenix/function/lazy_smart.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_PHOENIX_FUNCTION_LAZY_SMART
0020 #define BOOST_PHOENIX_FUNCTION_LAZY_SMART
0021
0022 namespace boost {
0023 namespace phoenix {
0024 namespace fcpp {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 struct SmartFunctoid {};
0044
0045
0046
0047
0048 struct smart_functoid0 : public SmartFunctoid {
0049 template <class Dummy, int i> struct crazy_accepts {
0050 static const bool args = false;
0051 };
0052 template <class Dummy> struct crazy_accepts<Dummy,0> {
0053 static const bool args = true;
0054 };
0055 static const int crazy_max_args = 0;
0056 };
0057
0058 struct smart_functoid1 : public SmartFunctoid {
0059 template <class Dummy, int i> struct crazy_accepts {
0060 static const bool args = false;
0061 };
0062 template <class Dummy> struct crazy_accepts<Dummy,1> {
0063 static const bool args = true;
0064 };
0065 static const int crazy_max_args = 1;
0066 };
0067
0068 struct smart_functoid2 : public SmartFunctoid {
0069 template <class Dummy, int i> struct crazy_accepts {
0070 static const bool args = false;
0071 };
0072 template <class Dummy> struct crazy_accepts<Dummy,1> {
0073 static const bool args = true;
0074 };
0075 template <class Dummy> struct crazy_accepts<Dummy,2> {
0076 static const bool args = true;
0077 };
0078 static const int crazy_max_args = 2;
0079 };
0080
0081 struct smart_functoid3 : public SmartFunctoid {
0082 template <class Dummy, int i> struct crazy_accepts {
0083 static const bool args = false;
0084 };
0085 template <class Dummy> struct crazy_accepts<Dummy,1> {
0086 static const bool args = true;
0087 };
0088 template <class Dummy> struct crazy_accepts<Dummy,2> {
0089 static const bool args = true;
0090 };
0091 template <class Dummy> struct crazy_accepts<Dummy,3> {
0092 static const bool args = true;
0093 };
0094 static const int crazy_max_args = 3;
0095 };
0096
0097
0098 namespace impl {
0099 template <class F, bool b> struct NeededASmartFunctoidButInsteadGot {};
0100 template <class F> struct NeededASmartFunctoidButInsteadGot<F,true> {
0101 typedef F type;
0102 };
0103 template <bool b> struct Ensure;
0104 template <> struct Ensure<true> {};
0105 }
0106
0107 template <class MaybeASmartFunctoid>
0108 struct functoid_traits {
0109 typedef typename boost::remove_reference<MaybeASmartFunctoid>::type MaybeASmartFunctoidT;
0110 typedef
0111 typename impl::NeededASmartFunctoidButInsteadGot<MaybeASmartFunctoidT,
0112 boost::is_base_and_derived<SmartFunctoid,
0113 MaybeASmartFunctoidT>::value>::type F;
0114 template <int i> struct accepts {
0115 static const bool args = F::template crazy_accepts<int,i>::args;
0116 };
0117 template <int i> struct ensure_accepts {
0118 static const bool ok = F::template crazy_accepts<int,i>::args;
0119 inline static void args() { (void) impl::Ensure<ok>(); }
0120 };
0121 static const int max_args = F::crazy_max_args;
0122 };
0123
0124
0125
0126
0127 template <typename F>
0128 struct smart_function0 : public smart_functoid0,
0129 public boost::phoenix::function<F>
0130 { };
0131
0132 template <typename F>
0133 struct smart_function1 : public smart_functoid1,
0134 public boost::phoenix::function<F>
0135 {
0136 typedef F type;
0137 };
0138
0139 template <typename F>
0140 struct smart_function2 : public smart_functoid2,
0141 public boost::phoenix::function<F>
0142 { };
0143
0144 template <typename F>
0145 struct smart_function3 : public smart_functoid3,
0146 public boost::phoenix::function<F>
0147 { };
0148 }
0149 }
0150 }
0151
0152
0153 #endif