Refactor UnitConverterDataLoader.cpp to correctly add pressure units

The commit fixes a bug in the code where the pressure units were not being added correctly. The issue was resolved by moving the `emplace` statement after adding the `pressureUnits` vector.
This commit is contained in:
Jacob Poteet 2024-02-10 16:06:29 -05:00
commit a01f7a9e3c

View file

@ -756,9 +756,9 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map<ViewMode, vector<Order
OrderedUnit{ UnitConverterUnits::Pressure_Pascal, GetLocalizedStringName(L"UnitName_Pascal"), GetLocalizedStringName(L"UnitAbbreviation_Pascal"), 5 }); OrderedUnit{ UnitConverterUnits::Pressure_Pascal, GetLocalizedStringName(L"UnitName_Pascal"), GetLocalizedStringName(L"UnitAbbreviation_Pascal"), 5 });
pressureUnits.push_back(OrderedUnit{ pressureUnits.push_back(OrderedUnit{
UnitConverterUnits::Pressure_PSI, GetLocalizedStringName(L"UnitName_PSI"), GetLocalizedStringName(L"UnitAbbreviation_PSI"), 6, false, false, false }); UnitConverterUnits::Pressure_PSI, GetLocalizedStringName(L"UnitName_PSI"), GetLocalizedStringName(L"UnitAbbreviation_PSI"), 6, false, false, false });
unitMap.emplace(ViewMode::Pressure, pressureUnits);
pressureUnits.push_back(OrderedUnit{ pressureUnits.push_back(OrderedUnit{
UnitConverterUnits::Pressure_Torr, GetLocalizedStringName(L"UnitName_Torr"), GetLocalizedStringName(L"UnitAbbreviation_Torr"), 7}); UnitConverterUnits::Pressure_Torr, GetLocalizedStringName(L"UnitName_Torr"), GetLocalizedStringName(L"UnitAbbreviation_Torr"), 7});
unitMap.emplace(ViewMode::Pressure, pressureUnits);
vector<OrderedUnit> angleUnits; vector<OrderedUnit> angleUnits;
angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Degree, angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Degree,