C++11 compatibility.

This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-11-14 23:35:28 -08:00
parent 69dac469fe
commit 1a2e8a6624

View File

@ -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",