[preprocessor] Enumerating sequence of pairs

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.

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Roman Perepelitsa
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?
#include
participants (2)
-
Paul Mensonides
-
Roman Perepelitsa