From 692b26754c7c619d9d9dc28548a87d43dd18c96b Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 1 May 2024 10:41:37 -0500 Subject: [PATCH] xo-pyunit: + equality comparison --- src/pyunit/pyunit.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pyunit/pyunit.cpp b/src/pyunit/pyunit.cpp index 6c02f329..9fef80a3 100644 --- a/src/pyunit/pyunit.cpp +++ b/src/pyunit/pyunit.cpp @@ -150,6 +150,24 @@ namespace xo { return x / y; }) + .def("__eq__", + [](const XoQuantity & x, const XoQuantity & y) + { + return x == y; + }) + + .def("__eq__", + [](const XoQuantity & x, double y) + { + return x == y; + }) + + .def("__req__", + [](const XoQuantity & y, double x) + { + return x == y; + }) + .def("__repr__", [](const XoQuantity & x) {