Problem
I have a template class in C++ that has a static method. It looks more or less like this:
template<typename T>
class Foo {
static std::shared_ptr<Foo<T>> doSth();
}
so in C++ you would call it like: Foo<Int>::doSth();
. In Cython however, the way to call static methods is by using the classname as a namespace:
cdef extern from "Bar.h" namespace "Bar":
shared_ptr[Bar] doSth() # assuming shared_ptr is already declared
but this has no notion of templates. Obviously, simply passing Foo<T>
as a namespace doesn't work, because it translates to Foo<T>::doStr()
in C++, no concrete type is substituted for T.
Question
How would you do that in Cython? Is there a way, or a workaround?