P
PengYu.UT
Hi,
I read Klaus Kreft & Angelika Langer's C++ Expression Templates: An
Introduction to the Principles of Expression Templates at
http://www.angelikalanger.com/Articles/Cuj/ExpressionTemplates/ExpressionTemplates.htm
It provide an express template for only one argument (see Listing 19
and so on), which can be used to do numerical integral.
I'm wondering how to generalize it to handle multiple arguments.
Say, I change the definition of Identity in Listing 19 such that it
have one `int' template argument. Then I have
Identity<1> x;
Identity<2> y;
Identity<3> z;
(x * y) and (y * z) should return two functions each of which accepts 2
arguments. But ((x * y) * (y * z)) should return a function which
accept 3 (not 4) arguments(and the arguments should be in the order of
x, y, z).
If you know anyone have implement this kind of expression template,
would you please share with me. Or if you can give me some hints on how
to define this expression template, it will helpful as well.
Thanks,
Peng
Best wishes,
Peng
I read Klaus Kreft & Angelika Langer's C++ Expression Templates: An
Introduction to the Principles of Expression Templates at
http://www.angelikalanger.com/Articles/Cuj/ExpressionTemplates/ExpressionTemplates.htm
It provide an express template for only one argument (see Listing 19
and so on), which can be used to do numerical integral.
I'm wondering how to generalize it to handle multiple arguments.
Say, I change the definition of Identity in Listing 19 such that it
have one `int' template argument. Then I have
Identity<1> x;
Identity<2> y;
Identity<3> z;
(x * y) and (y * z) should return two functions each of which accepts 2
arguments. But ((x * y) * (y * z)) should return a function which
accept 3 (not 4) arguments(and the arguments should be in the order of
x, y, z).
If you know anyone have implement this kind of expression template,
would you please share with me. Or if you can give me some hints on how
to define this expression template, it will helpful as well.
Thanks,
Peng
Best wishes,
Peng