Boost logo

Boost Users :

From: Server Levent Yilmaz (leventyilmaz_at_[hidden])
Date: 2007-06-15 16:44:21


Hi,

I have the following fun problem, seemingly simple, but couldn't find the
trick.

The objective is to convert a given argument list to some other one or more
useful argument list. Each of the arguments are copied verbatim into the
other list unless it is specified to be a SPECIAL_TYPE.

For example the following two-argument macro function call:

FUNKY_MACRO( 5, ( double*, SPECIAL_TYPE, const char[], SPECIAL_TYPE, int) )

would spit out:

(double*, const char[], int, special1, special1);
(double*, special1, const char[], special1, int, special2,
special2);

note that, in the first generated tuple SPECIAL_TYPE is replaced by some
other text, and moved to the end of the tuple. In the second one, same
replacement occurs and some yet other text is appended repeatedly at the
end, same number of times as SPECIAL_TYPE appears in the original list.

Any ideas how to do this (or part of it) with the incredibly amazing
Preprocessor library?

thanks

-- 
Server Levent Yilmaz
Mechanical Engineering
University of Pittsburgh


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