[aspectc-user] more on templates
panu.bloigu at mbnet.fi
Tue Feb 13 10:08:35 CET 2007
I have a question concerning templates. However, this time my question is of
theoretical kind since I know the code I'm going to present contains
features which are not supported by the current AspectC++ compiler. What I'm
asking is that is my code syntactically correct AspectC++ code and should it
work if there existed a full implementation of AspectC++ language?
I have the following aspect:
1: #include <iostream>
2: aspect Test
4: pointcut target_methods() = "void ClassA::method()" || "void
6: advice execution(target_methods()) : before()
11: // Should this work or not?
12: advice execution("void Test::do_before<ClassA>(ClassA*)") : around()
14: // do something specific to ClassA
18: template<class That> static void do_before(That* that)
20: // do something with 'that';
My specific question is that whether the pcd on the line 12 would do what
I'm expecting it to do? What I'm especially worried about is the fact that
the template is instantiated from within an advice.
If the above code would work as such, would it still work if I switched the
order of the advices so that the advice beginning on the line 12 would
precede the other advice? Does the order matter here?
Also, what is the correct pcd syntax for matching all instatiations of a
template? Would it be something like "% AClass<...>::%(...)" or "%
AClass<%>::%(...)"? Note the '%' sign vs. '...'.
Let me emphasise that I know that this does not work with current AspectC++
implementation. My questions are purely language-wise.
Thanks in advance,
More information about the aspectc-user