Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I wrap derived template class? #2759

Open
cmpute opened this issue Dec 15, 2018 · 0 comments
Open

How can I wrap derived template class? #2759

cmpute opened this issue Dec 15, 2018 · 0 comments

Comments

@cmpute
Copy link

cmpute commented Dec 15, 2018

Basically the situation is like the following:
In C++ I have base template class and derived template class defined:

template <class T> class A {...}
template <class T> class B : A<T> {...}
template <class T> void function(smart_ptr<A<T>> input){...}

I want to wrap them into cython,

cdef extern from "header.h":
    cdef cppclass A[T]:
        pass
    cdef cppclass B[T](A[T]):
        pass
    cdef void function[T](smart_ptr[A[T]] input)

The cython compiler told me that A[T] cannot feed in as the base type of B and also I cannot feed B instance into "function" even if I make cppclass B not derived from A. How can I achieve this purpose?

I found similar problems on several websites and I guess maybe cython doesn't directly support it now. Is there any workaround? Otherwise, maybe this problem should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant