2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-26 06:42:27 +00:00

Added complex support, and support for user-defined conversions of classic instances

[SVN r12938]
This commit is contained in:
Dave Abrahams
2002-02-25 21:20:05 +00:00
parent e014765797
commit f6381e7e5e
4 changed files with 132 additions and 13 deletions

View File

@@ -8,6 +8,7 @@
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/detail/none.hpp>
# include <string>
# include <complex>
namespace boost { namespace python {
@@ -58,6 +59,9 @@ BOOST_PYTHON_TO_PYTHON_BY_VALUE(float, PyFloat_FromDouble(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(double, PyFloat_FromDouble(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(long double, PyFloat_FromDouble(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(PyObject*, x ? x : detail::none())
BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<float>, PyComplex_FromDoubles(x.real(), x.imag()))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<double>, PyComplex_FromDoubles(x.real(), x.imag()))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<long double>, PyComplex_FromDoubles(x.real(), x.imag()))
namespace converter
{