On 6/15/07, Arkadiy Vertleyb
"Server Levent Yilmaz"
wrote I have a related, simpler question:
Given a tuple (or any other container) with arbitrary elements, is there a way to determine if an element is SPECIAL_TEXT or some other text. For example given, ( a, b, SPECIAL_TEXT, c, d ), can we construct (0, 0, 1, 0, 0)?
If you know all the possibilities in advance, you can do something like:
#define LOOKING_FOR_SPECIAL_TEXT 1 #define LOOKING_FOR_a 0 #define LOOKING_FOR_b 0 #define LOOKING_FOR_c 0 #define LOOKING_FOR_d 0
and then transform the sequence using concatination LOOKING_FOR_ with the current item.
Nope, I don't know in advance. In fact, those (a,b,...) are not really
single character text, but rather comma separated formal arguments to a
function such as (real *, const char[], etc... ), so concat wouldnt work
even if I knew the types a priori.
I did somehow come up with this dirty trick, though it doesn't quite cut it:
#include