fork(1) download
  1. #include <boost/preprocessor.hpp>
  2.  
  3. struct O
  4. {
  5. template <class T1, class T2>
  6. struct A {};
  7. };
  8.  
  9. template<class T>
  10. struct argument_type;
  11. template<class T, class U>
  12. struct argument_type<T(U)>
  13. {
  14. using type = U;
  15. };
  16.  
  17. #define TDEF(TYPE, NAME) using NAME = argument_type<void(TYPE)>::type
  18. #define INHERIT(R, DATA, ELEM) , argument_type<void(BOOST_PP_SEQ_ELEM(0, ELEM))>::type
  19. #define MEMBER(R, DATA, ELEM) TDEF(BOOST_PP_SEQ_ELEM(0, ELEM), BOOST_PP_SEQ_ELEM(1, ELEM));
  20. #define CREATE_CLASS(NAME, MEMBERS) \
  21. struct NAME \
  22. : argument_type<void(BOOST_PP_SEQ_ELEM(0, BOOST_PP_SEQ_HEAD(MEMBERS)))>::type \
  23. BOOST_PP_SEQ_FOR_EACH(INHERIT, _, BOOST_PP_SEQ_TAIL(MEMBERS)) \
  24. { \
  25. BOOST_PP_SEQ_FOR_EACH(MEMBER, _, MEMBERS) \
  26. }
  27.  
  28. CREATE_CLASS(test_class, (((O::A<int*, int>))(val)));
  29.  
  30. int main()
  31. {
  32. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty