C++ wrapping : Template bug ?
2010-08-03 08:53:15 GMT
Hi, I am experiencing a strange behavior of Cython when trying to wrap STL containers.
I copy/pasted the code available here : http://wiki.cython.org/WrappingCPlusPlus#Templates
This works fine if I keep "int" as the template parameter. It still works fine if I put "int *".
If I now add:
cdef extern from "test.h":
cdef cppclass TestClass:
TestClass()
below the list declaration, it still works fine with "TestClass" as the template param.
But surprisingly, it does not even compile to c++ if I write "TestClass *".
The error message is:
cdef vector[TestClass *] *v = new vector[TestClass *]()
^
------------------------------------------------------------
/home/lionel/test/test_cython.pyx:21:23: Expected an identifier or literal
It seems like a bug, but I'm quite tired today so I might have missed something. If it is indeed a bug, what do you suggest as a workaround ?
(I use the repository "trunk" version)
Lionel
RSS Feed