Boost logo

Boost Users :

From: Roman Perepelitsa (romka_at_[hidden])
Date: 2006-08-03 05:02:31


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net