xo-pyunit: + addition

This commit is contained in:
Roland Conybeare 2024-05-01 10:23:09 -05:00
commit d8580214d5

View file

@ -67,6 +67,25 @@ namespace xo {
.def("reciprocal", &XoQuantity::reciprocal)
.def("rescale", &XoQuantity::rescale,
py::arg("unit"))
.def("__add__",
[](const XoQuantity & x, const XoQuantity & y)
{
return x + y;
})
.def("__add__",
[](const XoQuantity & x, double y)
{
return x + y;
})
.def("__radd__",
[](double y, const XoQuantity & x)
{
return x + y;
})
.def("__mul__",
[](const XoQuantity & x, const XoQuantity & y)
{