[aspectc-user] calls to template members not matched

Panu Bloigu panu.bloigu at mbnet.fi
Fri Jan 5 10:58:38 CET 2007


Hello.

I've understood that weaving in template code isn't yet implemented in ac++
1.0pre3. However, on May 26th 2006 Olaf said on the list that:

> I'm sorry, but weaving *in* templates still does not work. The only
> template-related feature that should work, although experimental, is
> advice for calls to member functions of template instances, if the call
> itself is not located within the template. For example, if there is a
> call to Client<Something>::run() within your main() function, call
> advice should work.

I don't seem to be able to get even this to work. Again, please consider the
three following files I have:

===================
File 1: ClassA.h
===================
ifndef CLASSA_H_
#define CLASSA_H_
#include <iostream>
template<class T>class ClassA
{
public:
	ClassA();
	virtual ~ClassA();
	void m();
};
template<class T> ClassA<T>::ClassA(){}
template<class T> ClassA<T>::~ClassA(){}
template<class T> void ClassA<T>::m()
{
	std::cout<<"ClassA::m() called!\n";
}
#endif /*CLASSA_H_*/

===================
File 2: main.cpp
===================
#include "ClassA.h"
int main()
{
	ClassA<int> a;
	a.m();
	return 0;
}

===================
File 3: AnAspect.ah
===================
#ifndef ANASPECT_AH_
#define ANASPECT_AH_
#include <iostream>
aspect AnAspect
{
	advice call("void ClassA<...>::m()") : around()
	{
		std::cout<<"Before call\n";
		tjp->proceed();
		std::cout<<("After call\n");
	}
};
#endif /*ANASPECT_AH_*/

================================================================================

With the above shown three files, the call pointcut in AnAspect isn't
matched. I'm starting to suspect there's something wrong with my code,
because from Olaf's post I've understood that this should work.

So, is there something wrong with my code or do I have misinterpreted what
Olaf had said? At this point it would be a great feature to have at least
the calls to template code working.

Thanks in advance,

Panu.






More information about the aspectc-user mailing list