fork download
  1. #include <boost/preprocessor.hpp>
  2. #include <iostream>
  3.  
  4. #define COMBINE(index, data, elem) (BOOST_PP_STRINGIZE(elem))(".")
  5.  
  6. #define API_METHOD(args) BOOST_PP_SEQ_CAT(args)
  7. #define INSERT_SEPARATOR(args, sep) BOOST_PP_SEQ_REVERSE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_REVERSE(BOOST_PP_SEQ_FOR_EACH(COMBINE, sep, args))))
  8.  
  9. #define FLATTEN_SEQ_HELPER(index, data, elem) elem
  10. #define FLATTEN_SEQ(args) BOOST_PP_SEQ_FOR_EACH(FLATTEN_SEQ_HELPER, _, args)
  11.  
  12. #define JOIN(args, sep) FLATTEN_SEQ(INSERT_SEPARATOR(args, sep))
  13.  
  14.  
  15. int main()
  16. {
  17. std::cout << JOIN((a)(b)(c), ".") << std::endl;
  18. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
a.b.c