Hello,
Not having a good time with the PP lately, and am struggling over the
following - would like to generate:
void foo(T1)
{
bar<T1>(a[0]);
}
void foo(T1, T2)
{
bar
Hello, I find I am still far from a solution to this, and hope someone might kindly chime in. At the _bottom_ of this email is what I've got so far, though falls short of a solution... help is still sorely needed.
Not having a good time with the PP lately, and am struggling over the following - would like to generate:
void foo(T1) { bar<T1>(a[0]); }
void foo(T1, T2) { bar
(a[0]); bar (a[1]); } void foo(T1, T2, T3) { bar
(a[0]); bar (a[1]); bar (a[2]); } ...and so on.
I have this far:
#define
2010/5/31 Manfred Doudar
Hello,
I find I am still far from a solution to this, and hope someone might kindly chime in. At the _bottom_ of this email is what I've got so far, though falls short of a solution... help is still sorely needed.
#include
Hello Roman,
Thank you ever so much, and for a lovely solution at that too; far
cleaner than the direction I was heading. Can't thank you enough!
--Manfred
On Mon, 31 May 2010 17:19:40 +0200
Roman Perepelitsa
2010/5/31 Manfred Doudar
Hello,
I find I am still far from a solution to this, and hope someone might kindly chime in. At the _bottom_ of this email is what I've got so far, though falls short of a solution... help is still sorely needed.
#include
#define VAR(z, n, k) \ bar
(a[n]); #define FUN(n) \ void foo(BOOST_PP_ENUM_PARAMS(n, T)) \ { \ BOOST_PP_REPEAT(n, VAR, n) \ }
#define BOOST_PP_LOCAL_MACRO(n) FUN(n) #define BOOST_PP_LOCAL_LIMITS (1, 3) #include BOOST_PP_LOCAL_ITERATE()
By the way, you don't have to undef BOOST_PP_LOCAL_MACRO and BOOST_PP_LOCAL_LIMITS. They are undef-ed in BOOST_PP_LOCAL_ITERATE.
Roman Perepelitsa.
Thank you ever so much Roman, and for a lovely solution at that too; far cleaner than the direction I was heading.
participants (2)
-
Manfred Doudar
-
Roman Perepelitsa