File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
power_grid_model_c/power_grid_model/include/power_grid_model Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 99
1010#include < exception>
1111#include < format>
12- #include < numeric>
1312#include < sstream>
1413#include < string>
1514#include < utility>
@@ -181,14 +180,9 @@ class UnsupportedRegulatorCombinationError : public PowerGridError {
181180
182181class ConflictingVoltageRegulatorURef : public PowerGridError {
183182 public:
184- ConflictingVoltageRegulatorURef (std::vector<ID> const & regulator_ids)
183+ ConflictingVoltageRegulatorURef (std::string const & regulator_ids)
185184 : PowerGridError{
186- std::format (" Conflicting u_ref values detected for voltage regulators {}." ,
187- std::accumulate (std::next (regulator_ids.begin ()), regulator_ids.end (),
188- std::to_string (regulator_ids[0 ]),
189- [](std::string a, ID b) { return a + " , " + std::to_string (b); }
190- )
191- )} {}
185+ std::format (" Conflicting u_ref values detected for voltage regulators {}." , regulator_ids)} {}
192186};
193187
194188class AutomaticTapCalculationError : public PowerGridError {
Original file line number Diff line number Diff line change @@ -554,7 +554,15 @@ class MainModelImpl {
554554 }
555555 }
556556 if (!conflicting_regulators.empty ()) {
557- throw ConflictingVoltageRegulatorURef{conflicting_regulators};
557+ // join IDs like this, because of various compiler errors with std::format and
558+ // std::accumulate when used in exception constructor
559+ std::ostringstream oss;
560+ for (size_t i = 0 ; i < conflicting_regulators.size (); ++i) {
561+ if (i > 0 ) oss << " , " ;
562+ oss << conflicting_regulators[i];
563+ }
564+ std::string ids = oss.str ();
565+ throw ConflictingVoltageRegulatorURef{ids};
558566 }
559567 }
560568 }
You can’t perform that action at this time.
0 commit comments