Dear list,
I exported the C++ function `sin` both for real and complex numbers
(`float` and `complex` in python / `double` and `std::complex` in C++)
and I noticed that calling `sin(2.3)` gives `(0.7457052121767203-0j)`
so a complex number. Why is that? In which order does boost python
handle over
Jim,
I didn't implement my own `version of std::complex` I just exported
`std::complex` as my own class. I only later found out that this type
is already exported by boost::python itself. I just stopped exporting
`std::complex` by myself which mostly works.
I am not fully happy with the situation
Did you already try .def'ing the functions with the order reversed? I think
it should work for your case.
Boost.Python uses a simple "first match" approach, I think trying bottom up
for functions and member functions, top down for constructors (for weird
reasons).
On Thu, Apr 12, 2012 at 9:48 AM,
Indeed, reversing the order works. Thanks also for the explanation.
This required to change my template metaprogramming code which I use
to export the classes. This is not optimal as I want to know that no
compiler errors occur for `double` before I get potentially more
complicated compiler errors