mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Look Up Time Step Object Exactly Once
Using .contains() followed by .at() with the same argument will perform the same map lookup twice.
This commit is contained in:
parent
62ce2b18e0
commit
6eebd01bd4
@ -48,10 +48,11 @@ RimWellAllocationOverTimeCollection::RimWellAllocationOverTimeCollection(
|
||||
QDateTime prevValidTimeStep;
|
||||
for ( auto it = m_timeStepDates.rbegin(); it != m_timeStepDates.rend(); ++it )
|
||||
{
|
||||
const QDateTime& timeStep = *it;
|
||||
if ( timeStepAndCalculatorPairs.contains( timeStep ) )
|
||||
const QDateTime& timeStep = *it;
|
||||
auto timeStepCalculatorIt = timeStepAndCalculatorPairs.find( timeStep );
|
||||
if ( timeStepCalculatorIt != timeStepAndCalculatorPairs.end() )
|
||||
{
|
||||
m_timeStepAndCalculatorPairs.emplace( timeStep, timeStepAndCalculatorPairs.at( timeStep ) );
|
||||
m_timeStepAndCalculatorPairs.emplace( timeStep, timeStepCalculatorIt->second );
|
||||
prevValidTimeStep = timeStep;
|
||||
}
|
||||
else if ( prevValidTimeStep.isValid() )
|
||||
|
Loading…
Reference in New Issue
Block a user