#10649 ApplicationLibCode: Use collection.empty() instead of comparing with size

This commit is contained in:
Kristian Bendiksen
2023-09-27 08:07:49 +02:00
parent 98796b0dd9
commit 959c9d48fa
220 changed files with 432 additions and 431 deletions

View File

@@ -136,7 +136,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( yAxis() );
if ( dateTimes.size() > 0 && dateTimes.size() == values.size() )
if ( !dateTimes.empty() && dateTimes.size() == values.size() )
{
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
{
@@ -147,7 +147,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
std::vector<double> times;
if ( dateTimes.size() )
if ( !dateTimes.empty() )
{
time_t startDate = dateTimes[0];
for ( time_t& date : dateTimes )

View File

@@ -178,7 +178,7 @@ void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address )
// Check if we got any data. If not, erase the map entry to comply with previous behavior
if ( !itAndIsInsertedPair.first->second.first.size() )
if ( itAndIsInsertedPair.first->second.first.empty() )
{
m_dataCache.erase( itAndIsInsertedPair.first );
}

View File

@@ -346,7 +346,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change
}
else if ( changedField == &m_filterMode )
{
if ( m_objectiveValuesSummaryAddresses.size() == 0 )
if ( m_objectiveValuesSummaryAddresses.empty() )
{
RimSummaryAddress* summaryAddress = new RimSummaryAddress();

View File

@@ -503,7 +503,7 @@ void RimEnsembleCurveSet::deleteEnsembleCurves()
curvesIndexesToDelete.push_back( c );
}
while ( curvesIndexesToDelete.size() > 0 )
while ( !curvesIndexesToDelete.empty() )
{
size_t currIndex = curvesIndexesToDelete.back();
delete m_curves[currIndex];
@@ -525,7 +525,7 @@ void RimEnsembleCurveSet::deleteStatisticsCurves()
curvesIndexesToDelete.push_back( c );
}
while ( curvesIndexesToDelete.size() > 0 )
while ( !curvesIndexesToDelete.empty() )
{
size_t currIndex = curvesIndexesToDelete.back();
delete m_curves[currIndex];
@@ -808,7 +808,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
if ( m_colorMode() == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
{
if ( m_objectiveValuesSummaryAddresses.size() == 0 )
if ( m_objectiveValuesSummaryAddresses.empty() )
{
RimSummaryAddress* summaryAddress = new RimSummaryAddress();
summaryAddress->setAddress( m_yValuesSummaryAddress->address() );

View File

@@ -155,7 +155,7 @@ double RimObjectiveFunction::value( RimSummaryCase*
}
}
if ( m_normalizeByNumberOfVectors && vectorSummaryAddresses.size() > 0 )
if ( m_normalizeByNumberOfVectors && !vectorSummaryAddresses.empty() )
{
aggregatedObjectiveFunctionValue /= vectorSummaryAddresses.size();
}