fork download
  1. #include <boost/algorithm/string.hpp>
  2. #include <boost/preprocessor.hpp>
  3. #include <iostream>
  4.  
  5. #define ELEMENT(n, product) BOOST_PP_TUPLE_ELEM(BOOST_PP_SEQ_SIZE(product), n, BOOST_PP_SEQ_TO_TUPLE(product))
  6.  
  7. #define COMBINER(r, product) ELEMENT(3, product) ELEMENT(2, product) ELEMENT(1, product) ELEMENT(0, product);
  8.  
  9. #define TEST(args) BOOST_PP_SEQ_FOR_EACH_PRODUCT(COMBINER, args)
  10.  
  11. #define TEST_STRING(args) BOOST_PP_STRINGIZE(TEST(args))
  12.  
  13. int main()
  14. {
  15. std::string s = TEST_STRING(((short)(int)(long))(()(unsigned))(()(volatile))(()(const)));
  16. boost::replace_all(s, "; ", ";\n");
  17. std::cout << s;
  18. }
  19.  
Success #stdin #stdout 0.01s 2824KB
stdin
Standard input is empty
stdout
short;
const short;
volatile short;
const volatile short;
unsigned short;
const unsigned short;
volatile unsigned short;
const volatile unsigned short;
int;
const int;
volatile int;
const volatile int;
unsigned int;
const unsigned int;
volatile unsigned int;
const volatile unsigned int;
long;
const long;
volatile long;
const volatile long;
unsigned long;
const unsigned long;
volatile unsigned long;
const volatile unsigned long;