Hi folks,
I'm trying to create a boost python class that works with either vec3 or
mat3 arrays (and I only need those two types). I made a templated class and
then exported it twice with different names, for the vec3 and mat3
versions. For example, for mat3:
class_
("ReconstituteDerivativesMat3", no_init) .def("get_data", &ReconstituteDerivatives< mat3<double> >::get_data) .def("get_indices", &ReconstituteDerivatives< std::size_t ::get_indices);
I can create one of these objects from Python
foo
but the accessors are not exported properly:
foo.get_data() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: No to_python (by-value) converter found for C++ type: scitbx::af::shared
I expected a scitbx_array_family_flex_ext.mat3_double here
foo.get_indices() Traceback (most recent call last): File "<stdin>", line 1, in <module> Boost.Python.ArgumentError: Python argument types in ReconstituteDerivativesMat3.get_indices(ReconstituteDerivativesMat3) did not match C++ signature: get_indices(dials::refinement::ReconstituteDerivatives<unsigned long> {lvalue})
and I expected a scitbx_array_family_flex_ext.size_t here. Is it likely there is something simple I am missing, like a #include? I do include flex_wrapper.h. Or perhaps I am just doing something wrong with templated classes and boost python. Looking at other code isn't helping to reveal the mysteries to me yet. Cheers -- David