#include "curryable.hpp" #include #include template struct type_u { type_u() { std::cout<<"type_u<"<()\n"; } type_u(type_u const&) { std::cout<<"type_u<"<(type_u const&)\n"; } }; template std::ostream& operator<< ( std::ostream& sout , type_uconst& x ) { sout<<"sout<\n"; return sout; } #define PRINT_TYPE_US_ARITY 3 #define TYPE_U_ARGS_DECL(Z, N, D) type_u< N >const& BOOST_PP_CAT(arg, N) #define TYPE_U_ARGS_PRINT(Z, N, D) std::cout<< BOOST_PP_CAT(arg, N); struct print_type_us { typedef void result_type ; result_type operator() ( BOOST_PP_ENUM(PRINT_TYPE_US_ARITY, TYPE_U_ARGS_DECL, ~) )const { BOOST_PP_REPEAT(PRINT_TYPE_US_ARITY, TYPE_U_ARGS_PRINT, ~) } }; int main() { print_type_us ptu; curryable p0(ptu); auto p1=p0(type_u<0>()); auto p2=p1(type_u<1>()); p2(type_u<2>()); return 0; }