mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 07:15:34 +08:00
T73 CMeasurementUnit converter strategy based on function pointers.
Because function pointers are literal types, so they can be constexpr.
This commit is contained in:
@@ -32,8 +32,8 @@ namespace BlackMisc
|
||||
double CMeasurementUnit::convertFrom(double value, const CMeasurementUnit &unit) const
|
||||
{
|
||||
if (this->isNull() || unit.isNull()) return 0;
|
||||
if (this->m_converter == unit.m_converter) return value;
|
||||
return this->m_converter->fromDefault(unit.m_converter->toDefault(value));
|
||||
if (this->m_toDefault == unit.m_toDefault && this->m_fromDefault == unit.m_fromDefault) return value;
|
||||
return this->m_fromDefault(unit.m_toDefault(value));
|
||||
}
|
||||
|
||||
QString CMeasurementUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const
|
||||
|
||||
Reference in New Issue
Block a user