
3 Aug
2006
3 Aug
'06
9:02 a.m.
Hello. I want to enumerate sequence of pairs but can't figure out how to do it using boost.preprocessor. Here is example. // sequence of pairs #define SEQ (a, b) (c, d) // How can I implement this macro? #define MAGIC(S) ... MAGIC(SEQ) expands to abcd. If I had possibility to convert SEQ to ((a, b)) ((c, d)) problem would be solved easily because it's standard sequence and thus can be enumerated using with BOOST_PP_SEQ_FOLD_LEFT or another boost.preprocessor algorithm. I have implemented macro which converts SEQ to ((a, b)) ((c, d)) but implementation is huge (I copy-pasted a lot of code from boost.preprocessor). Now I need to enumerate sequence of triples and I don't want to copy-paste again. Any tips? Roman Perepelitsa.