mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 23:22:01 +00:00
C++11 compatibility.
This commit is contained in:
parent
69dac469fe
commit
1a2e8a6624
@ -83,6 +83,7 @@ void bind_basics(py::module &basics) {
|
|||||||
|
|
||||||
pyPoint.def(py::init<>())
|
pyPoint.def(py::init<>())
|
||||||
.def(py::init<double, double>(), py::arg("x"), py::arg("y"))
|
.def(py::init<double, double>(), py::arg("x"), py::arg("y"))
|
||||||
|
#ifdef PYBIND11_CPP14
|
||||||
.def("distance_to",
|
.def("distance_to",
|
||||||
py::overload_cast<double, double>(&Point::distance_to, py::const_),
|
py::overload_cast<double, double>(&Point::distance_to, py::const_),
|
||||||
py::arg("x"),
|
py::arg("x"),
|
||||||
@ -90,6 +91,15 @@ void bind_basics(py::module &basics) {
|
|||||||
.def("distance_to",
|
.def("distance_to",
|
||||||
py::overload_cast<const Point &>(&Point::distance_to, py::const_),
|
py::overload_cast<const Point &>(&Point::distance_to, py::const_),
|
||||||
py::arg("other"))
|
py::arg("other"))
|
||||||
|
#else
|
||||||
|
.def("distance_to",
|
||||||
|
static_cast<double (Point::*)(double, double) const>(&Point::distance_to),
|
||||||
|
py::arg("x"),
|
||||||
|
py::arg("y"))
|
||||||
|
.def("distance_to",
|
||||||
|
static_cast<double (Point::*)(const Point &) const>(&Point::distance_to),
|
||||||
|
py::arg("other"))
|
||||||
|
#endif
|
||||||
.def_readwrite("x", &Point::x)
|
.def_readwrite("x", &Point::x)
|
||||||
.def_property(
|
.def_property(
|
||||||
"y",
|
"y",
|
||||||
|
Loading…
Reference in New Issue
Block a user