On 2020-02-07 4:06 p.m., HOUSSEN Franck wrote:
With boost python, how to pass a tuple of lists from python to C++ ? Code attached : line 12 crashes ?! Googling but no fix for now.

You are referring to this line:

  np::ndarray lsInt = boost::python::extract<np::ndarray>(t[0]);

Note that this line is actually doing two things:

1) it creates a boost::python::extract<np::ndarray> object

2) it calls conversion operator on it to convert to np::ndarray

Note that the conversion may fail (for example if the object doesn't contain an object of that type). In case of doubt, you may want to call extract::check() to see whether it's actually valid.

See https://www.boost.org/doc/libs/1_72_0/libs/python/doc/html/reference/to_from_python_type_conversion.html#to_from_python_type_conversion.boost_python_extract_hpp.class_template_extract for details.



Stefan

--

      ...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to