[aspectc-user] Slicing an object created with a template class

David Come davidbrcz at gmail.com
Sat Jun 20 16:06:48 CEST 2009


Hi all.
I'm still playing with aspect C++ and I've found something weird: i can't
slicing an object created  with a template class (like a std::vector<int> )
Have a look:
================================
// a.ah

#ifndef A_AF
#define A_AF
class Slice
{
int i; //all is fine
// std::vector<int> vec; //error
};

aspect Foo
{
pointcut what() = "A";
advice what(): slice Slice;
};

#endif
================================
//a.cpp
class A
{
//...
};

int main()
{
return 0;
}
================================
With this simple code, I've got the following error:
asp.ah:23: error: cannot declare `std::vector' within `Compte'
error: "ac++" --config "/tmp/agxx_pcfg1s6c0a" -p. -c "essai2.cpp" -o
"/tmp/essai2.cpp_agxx_SliceCMTBo"

And if I try with my own template class like:
================================
template <class T> TMP {};
class Slice
{
TMP<int> vec; //error
};
================================
I've got:
asp.ah:22: error: invalid member declaration near token `<'
asp.ah:22: located in the following non-file unit:
  private:
  typedef A Slice;

#line 22 "asp.ah"
 TMP< int > vec

Does anyone know why ? I know there are some problems with template and
aspect C++, but I think it is not this sort of problems.

Thanks.
David Côme.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20090620/fe64b72c/attachment.html>


More information about the aspectc-user mailing list