> You have defined "add" to return a reference (mapped_matrix_ext[T]&)
> but are assigning the result to a pointer (mapped_matrix_ext[double]*).
> On Thursday, April 19, 2012 12:25:29 PM UTC-7, csd wrote:
> Hi all,
> I am trying to wrap some C++ code in Cython and am having trouble
> with references. Here is a code snippet:
> cdef extern from "mapped_matrix_ext.h":
> cdef cppclass mapped_matrix_ext[T]:
> mapped_matrix_ext(int, int, int)
> mapped_matrix_ext[T]& add(mapped_matrix_ext[T]&)
> cdef mapped_matrix_ext[double] *A = new
> mapped_matrix_ext[double](3, 3, 5)
> cdef mapped_matrix_ext[double] *B = new
> mapped_matrix_ext[double](3, 3, 5)
> cdef mapped_matrix_ext[double] *C
> C = A.add(deref(B))
> I get the error "Cannot assign type 'mapped_matrix_ext<double> &'
> to 'mapped_matrix_ext<double> *'" for the last line which I think
> means that I need to find the reference of the value returned by
> the add method. I wasn't able to find how to do this in the
> documentation however (I think it's meant to be in
> "Declaring/Using References" which hasn't yet been written). Could
> someone please help me out?
> Thanks for any help,
> Charanpal