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

This commit is contained in:
Kristian Bendiksen
2023-09-25 13:44:35 +02:00
parent a4def5d407
commit 98796b0dd9
41 changed files with 77 additions and 77 deletions

View File

@@ -48,7 +48,7 @@ namespace caf
ColorTable::ColorTable( const std::vector<cvf::Color3ub>& colors )
: m_colors( colors )
{
CVF_ASSERT( m_colors.size() > 0 );
CVF_ASSERT( !m_colors.empty() );
}
//--------------------------------------------------------------------------------------------------
@@ -57,7 +57,7 @@ ColorTable::ColorTable( const std::vector<cvf::Color3ub>& colors )
ColorTable::ColorTable( const cvf::Color3ubArray& colors )
: m_colors( colors.begin(), colors.end() )
{
CVF_ASSERT( m_colors.size() > 0 );
CVF_ASSERT( !m_colors.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -190,12 +190,12 @@ bool Utils::getSaveDirectoryAndCheckOverwriteFiles( const QString& defaultDir, s
}
}
if ( filesToOverwrite.size() == 0 )
if ( filesToOverwrite.empty() )
{
overWriteFiles = true;
return overWriteFiles;
}
else if ( filesToOverwrite.size() > 0 )
else if ( !filesToOverwrite.empty() )
{
QMessageBox msgBox;

View File

@@ -113,7 +113,7 @@ void CellRangeFilter::addCellExclude( size_t i, size_t j, size_t k, bool applyTo
//--------------------------------------------------------------------------------------------------
bool CellRangeFilter::isCellVisible( size_t i, size_t j, size_t k, bool isInSubGridArea ) const
{
if ( m_includeRanges.size() == 0 )
if ( m_includeRanges.empty() )
{
return false;
}
@@ -159,7 +159,7 @@ bool CellRangeFilter::isCellExcluded( size_t i, size_t j, size_t k, bool isInSub
//--------------------------------------------------------------------------------------------------
bool CellRangeFilter::hasIncludeRanges() const
{
if ( m_includeRanges.size() > 0 )
if ( !m_includeRanges.empty() )
return true;
else
return false;
@@ -411,7 +411,7 @@ void StructGridGeometryGenerator::computeArrays()
if ( isCellFaceVisible( i, j, k, StructGridInterface::POS_K ) )
visibleFaces.push_back( cvf::StructGridInterface::POS_K );
if ( visibleFaces.size() > 0 )
if ( !visibleFaces.empty() )
{
cvf::Vec3d cornerVerts[8];
m_grid->cellCornerVertices( cellIndex, cornerVerts );