From e7e8396543c4a95d8e30679c32eddfb935dfe0e8 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 1 May 2024 10:32:15 -0500 Subject: [PATCH] xo-pyunit: + subtraction --- src/pyunit/pyunit.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pyunit/pyunit.cpp b/src/pyunit/pyunit.cpp index 921040bd..6c02f329 100644 --- a/src/pyunit/pyunit.cpp +++ b/src/pyunit/pyunit.cpp @@ -100,6 +100,24 @@ namespace xo { return x + y; }) + .def("__sub__", + [](const XoQuantity & x, const XoQuantity & y) + { + return x - y; + }) + + .def("__sub__", + [](const XoQuantity & x, double y) + { + return x - y; + }) + + .def("__rsub__", + [](double y, const XoQuantity & x) + { + return x - y; + }) + .def("__mul__", [](const XoQuantity & x, const XoQuantity & y) {