| 63 | #define FWD_REF(z, n, name) BOOST_PP_CAT(BOOST_FWD_REF(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, name), n)) BOOST_PP_TUPLE_ELEM(2, 1, name), n) |
| 64 | #define FWD(x, y) boost::forward<x>(y) |
| 65 | #define FWDER(z, n, x) FWD(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, x), n), BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, x), n)) |
| 66 | |
| 67 | #define FN(z, n, data) \ |
| 68 | template<BOOST_PP_ENUM_PARAMS(n, class T)> \ |
| 69 | typename boost::result_of<T( BOOST_PP_ENUM_PARAMS(n, T) )>::type \ |
| 70 | operator()( BOOST_PP_ENUM(n, FWD_REF, (T, t) ) ) \ |
| 71 | { \ |
| 72 | return t_->operator()(BOOST_PP_ENUM(n, FWDER, (T, t) )); \ |
| 73 | } \ |
| 74 | |
| 75 | // null-ary written without FN macro to prevent no-argument template |
| 76 | typename boost::result_of<T()>::type |
| 77 | operator()() |
| 78 | { |
| 79 | return t_->operator()(); |
| 80 | } |
| 81 | |
| 82 | // TODO make argument length configurable |
| 83 | BOOST_PP_REPEAT_FROM_TO(1, 8, FN, _); |
| 84 | |
| 85 | #undef FWD_REF |
| 86 | #undef FWD |
| 87 | #undef FWDER |
| 88 | #undef FN |
| 89 | |