Base: Units: return std::string

This commit is contained in:
Ladislav Michl
2024-07-12 20:51:54 +02:00
committed by Yorik van Havre
parent 6b6e1fbd26
commit 0907c7bfda
24 changed files with 181 additions and 174 deletions

View File

@@ -42,7 +42,7 @@ std::string QuantityPy::representation() const
Py::Float flt(val);
ret << static_cast<std::string>(flt.repr());
if (!unit.isEmpty()) {
ret << " " << unit.getString().toUtf8().constData();
ret << " " << unit.getString();
}
return ret.str();
@@ -63,7 +63,7 @@ PyObject* QuantityPy::toStr(PyObject* args)
ret.setf(std::ios::fixed, std::ios::floatfield);
ret << val;
if (!unit.isEmpty()) {
ret << " " << unit.getString().toUtf8().constData();
ret << " " << unit.getString();
}
return Py_BuildValue("s", ret.str().c_str());