[C++-sig] On wrapping vector >
by Zhang Le other posts by this author
Sep 29 2003 11:51PM messages near this date
[C++-sig] Re: vector_indexing_suite too defensive ...
|
Re: [C++-sig] On wrapping vector >
Hello,
I'm trying to wrap a function that takes a vector<pair<string, double> >
as input and return a list. The original function is
vector<double> eval(const vector<pair<string, double> >&);
to use boost python, I write a wrapper function:
python::list py_eval(python::tuple input) {
here I want to use python::extract<std::string> (input[i][0])
and python::extract<double> (py_context[i][1])
to transform python input [('A', 1.0), ('B', 2.0), ...]
into a new vector<pair<string, double> > for calling real
eval()
}
Compilation is ok and I get an error in python code:
obj.py_eval([('A', 1.0), ('B', 2.0)])
TypeError: No registered converter was able to produce a C++ rvalue
of type j from this Python object of type str
I change the declaration to python::list input, python::object input
and get the same error result.
Am I missing anything?
--
Sincerely yours,
Zhang Le
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Zhang Le
Nicodemus
|