Skip to content

Commit

Permalink
Convert size() comparisons to using empty
Browse files Browse the repository at this point in the history
It's easier to read, but in the case of std::list this provides a constant time comparison.
  • Loading branch information
Zack Moratto committed May 15, 2010
1 parent dfc967e commit 0e24454
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/asp/Core/BlobIndexThreaded.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void BlobCompressed::add_row( Vector2i const& start,
void BlobCompressed::absorb( BlobCompressed const& victim ) {

// First check to see if I'm empty
if ( m_row_start.size() == 0 ) {
if ( m_row_start.empty() ) {
m_min = victim.min();
for ( int i = 0; i < victim.num_rows(); i++ ) {
m_row_start.push_back( victim.start(i) );
Expand Down
2 changes: 1 addition & 1 deletion src/asp/IsisIO/RPNEquation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ double RPNEquation::evaluate( std::vector<std::string>& commands,
std::vector<double>& consts,
double const& t ) {
// Evaluates an equation in the internal format
if ( commands.size() == 0 )
if ( commands.empty() )
return 0;
int consts_index = 0;
std::stack<double> rpn_stack;
Expand Down
4 changes: 2 additions & 2 deletions src/asp/Tools/stereo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int main(int argc, char* argv[]) {

// If the user hasn't specified a stereo session type, we take a
// guess here based on the file suffixes.
if (stereo_session_string.size() == 0) {
if (stereo_session_string.empty()) {
if ( (boost::iends_with(cam_file1, ".cahvor") && boost::iends_with(cam_file2, ".cahvor")) ||
(boost::iends_with(cam_file1, ".cahv") && boost::iends_with(cam_file2, ".cahv")) ||
(boost::iends_with(cam_file1, ".pin") && boost::iends_with(cam_file2, ".pin")) ||
Expand Down Expand Up @@ -214,7 +214,7 @@ int main(int argc, char* argv[]) {
bool check_for_camera_models = true;
if ( stereo_session_string == "isis" ) {
// Fix the ordering of the arguments if the user only supplies 3
if (out_prefix.size() == 0)
if (out_prefix.empty())
out_prefix = cam_file1;
check_for_camera_models = false;
}
Expand Down

0 comments on commit 0e24454

Please sign in to comment.