@@ -8,6 +8,9 @@ ExchangeWrapper::ExchangeCompWrapper::ExchangeCompWrapper(cxxExchComp &comp)
88
99void ExchangeWrapper::ExchangeCompWrapper::get (
1010 std::span<LDBLE > &exchange) const {
11+
12+ std::size_t exch_index = this ->NUM_NOT_TOTALS ;
13+
1114 exchange[0 ] = exch_comp.Get_totals ().find (exch_comp.Get_formula ())->second ;
1215 exchange[1 ] = exch_comp.Get_charge_balance ();
1316 exchange[2 ] = exch_comp.Get_la ();
@@ -16,15 +19,16 @@ void ExchangeWrapper::ExchangeCompWrapper::get(
1619
1720 for (const auto &[name, value] : exch_comp.Get_totals ()) {
1821 if (name != exch_comp.Get_formula ()) {
19- exchange[NUM_NOT_TOTALS +
20- std::distance (exch_comp.Get_totals ().begin (),
21- exch_comp.Get_totals ().find (name))] = value;
22+ exchange[exch_index++] = value;
2223 }
2324 }
2425}
2526
2627void ExchangeWrapper::ExchangeCompWrapper::set (
2728 const std::span<LDBLE > &exchange) {
29+
30+ std::size_t exch_index = this ->NUM_NOT_TOTALS ;
31+
2832 exch_comp.Get_totals ().find (exch_comp.Get_formula ())->second = exchange[0 ];
2933 exch_comp.Set_charge_balance (exchange[1 ]);
3034 exch_comp.Set_la (exchange[2 ]);
@@ -33,9 +37,7 @@ void ExchangeWrapper::ExchangeCompWrapper::set(
3337
3438 for (auto &[name, value] : exch_comp.Get_totals ()) {
3539 if (name != exch_comp.Get_formula ()) {
36- value = exchange[NUM_NOT_TOTALS +
37- std::distance (exch_comp.Get_totals ().begin (),
38- exch_comp.Get_totals ().find (name))];
40+ value = exchange[exch_index++];
3941 }
4042 }
41- }
43+ }
0 commit comments