[aspectc-user] Pointcut & template class

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Jan 18 09:56:09 CET 2007


Hi,

the AspectC++ language does not allow you match templates, only template
*instances*. Therefore, what you problable mean is:

pointcut pippoPointcut() = "pippo<%>"; // matches all pippo instances

You could then give advice for all call to member functions of the
template by:

advice call(pippoPointcut()) : before () {
  cout << "pippo called" << endl;
}

However, please note that the template support in AspectC++ is still in
a very early state. The weaver cannot manipulate the template instances,
only non-template code. The advice above would only match calls that are
not located within the template itself. Also note that you will have to
compile with --real-instances.

Olaf

Luigi 'Comio' Mantellini wrote:
> Dear All,
> 
> How can I define a statitic pointcut that describe a template class?
> 
> In other words, I'm searching for a solution like this:
> 
> template <class T>
> pippo { ...
> };
> 
> adivice myAdv {
> ....
>   pointcut pippoPointcut() ="pippo<T>";
> ....
> }
> 
> 
> thanks!
> 
> luigi
> 




More information about the aspectc-user mailing list