[SciPy-dev] Question: general heap implementation versus specific?

Sturla Molden sturla@molden...
Tue Mar 3 06:22:52 CST 2009

On 3/3/2009 12:36 PM, David Cournapeau wrote:

> There are partial solutions to this problem, I don't know if you are
> aware of them:
>  - autogen: http://www.gnu.org/software/autogen/
>  - Python pre-processing (using for example the template system we
> have in numpy for .src files).

Yet another option (if you will excuse the profanity) is to make Cython 
generate C++. Cython allows C name specifiers that can be used to get 
C++ syntax compiled into the output.

# template<class T>
# void foobar(T arg);

ctypedef void templateT_void "template<class T> void"
ctypedef int T

cdef templateT_void foobar(T arg):

# template<class T>
# T foobar(T arg);

ctypedef T templateT_T "template<class T> T"

cdef templateT_T foobar(T arg):

Presumably, the C naming syntax of Cython should also make it possible 
to use C++ template container classes from STL or Boost.

Sturla Molden

More information about the Scipy-dev mailing list