I have a function implemented in func.hpp by C++ as
void func(const std::vector<std::shared_ptr<double> > &x) {
//something is doing here.
}
and in the swig .i file, I have added
%include <std_shared_ptr.i>
%include <std_vector.i>
%shared_ptr(DoubleValue)
%template(doublevec) std::vector<double>;
%template(doubleptrvec) std::vector<std::shared_ptr<double> >;
%{
#include "func.hpp"
}
%include "func.hpp"
When I call the function in python as
x=0.1
func([x])
I got error saying TypeError: in method 'func', argument 2 of type 'std::vector< std::shared_ptr< double >,std::allocator< std::shared_ptr< double > > >'.
I think I must do something to pass python objects as pointers to C++ function: does anyone have experience for this?