diff --git a/opm/simulators/wells/GroupState.cpp b/opm/simulators/wells/GroupState.cpp index 439da83e77..3163757b6a 100644 --- a/opm/simulators/wells/GroupState.cpp +++ b/opm/simulators/wells/GroupState.cpp @@ -514,9 +514,12 @@ void GroupState:: update_group_production_potential(const std::string& gname, Scalar oil_rate, Scalar gas_rate, Scalar water_rate) { - this->production_group_potentials.emplace( - gname, GroupPotential{oil_rate, gas_rate, water_rate} + auto [it, inserted] = production_group_potentials.try_emplace( + gname, oil_rate, gas_rate, water_rate ); + if (!inserted) { + it->second = GroupPotential{oil_rate, gas_rate, water_rate}; + } } template