[preprocessor] Enumerating sequence and shifter sequence
Hi. I have the following sequence #define SEQ (a)(b)(c)(d) I want to transform it to something like this F(a,b) F(b,c) F(c,d) How can I do it efficiently and elegantly? Thank you in advance. 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 the following sequence
#define SEQ (a)(b)(c)(d)
I want to transform it to something like this
F(a,b) F(b,c) F(c,d)
How can I do it efficiently and elegantly?
Thank you in advance.
Is F a macro? Regards, Paul Mensonides
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Paul Mensonides
I have the following sequence
#define SEQ (a)(b)(c)(d)
I want to transform it to something like this
F(a,b) F(b,c) F(c,d)
How can I do it efficiently and elegantly?
Thank you in advance.
Is F a macro?
In the mean time, the following should get you started...
#include
Paul Mensonides
In the mean time, the following should get you started... [cut] #define SEQ \ (a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m) \ (n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z) \ /**/
A(SEQ)
Thank you, Paul. This is exactly what I need :-) Roman Perepelitsa.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Roman Perepelitsa
Paul Mensonides
writes: In the mean time, the following should get you started... [cut] #define SEQ \ (a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m) \ (n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z) \ /**/
A(SEQ)
Thank you, Paul. This is exactly what I need :-)
Be warned that the sequence that results from the above is a *binary* sequence, and the facilities in the pp-lib cannot deal with binary sequences--only unary. That's not a showstopper, but it means that you can't use generic tools (at least those provided by the pp-lib) to manipulate the result, so you'll have to "manually" generate whatever it is that you want to generate. However, if you can follow how the above works, you should be able to do that without too much difficulty. Regards, Paul Mensonides
Paul Mensonides
Be warned that the sequence that results from the above is a *binary* sequence, and the facilities in the pp-lib cannot deal with binary sequences--only unary. That's not a showstopper, but it means that you can't use generic tools (at least those provided by the pp-lib) to manipulate the result, so you'll have to "manually" generate whatever it is that you want to generate. However, if you can follow how the above works, you should be able to do that without too much difficulty.
Some time ago I've posted question about binary pp sequences to this list. And you were so kind to supply me with this macro: # define BINARY_SEQ_TO_SEQ(seq) BINARY_SEQ_TO_SEQ_I(seq) # define BINARY_SEQ_TO_SEQ_I(seq) BOOST_PP_CAT(BINARY_SEQ_TO_SEQ_A seq, 0) # define BINARY_SEQ_TO_SEQ_A(x, y) ((x, y)) BINARY_SEQ_TO_SEQ_B # define BINARY_SEQ_TO_SEQ_B(x, y) ((x, y)) BINARY_SEQ_TO_SEQ_A # define BINARY_SEQ_TO_SEQ_A0 # define BINARY_SEQ_TO_SEQ_B0 Thans again for wonderfull library and great help on this mailing list. Roman Perepelitsa.
participants (2)
-
Paul Mensonides
-
Roman Perepelitsa