From 01a21f67f79d8bec7d767a735023751d6ebfc23a Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 18 Jul 2017 08:08:17 +0100 Subject: [PATCH] Converted a load of spelt out iterators to auto --- include/internal/catch_run_context.cpp | 2 +- include/internal/catch_tag_alias_registry.cpp | 2 +- include/internal/catch_test_case_tracker.hpp | 2 +- include/reporters/catch_reporter_bases.cpp | 2 +- include/reporters/catch_reporter_compact.cpp | 2 +- include/reporters/catch_reporter_console.cpp | 2 +- include/reporters/catch_reporter_tap.hpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index a44e6a64..a8d36122 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -277,7 +277,7 @@ namespace Catch { void RunContext::handleUnfinishedSections() { // If sections ended prematurely due to an exception we stored their // infos here so we can tear them down outside the unwind process. - for (std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), + for (auto it = m_unfinishedSections.rbegin(), itEnd = m_unfinishedSections.rend(); it != itEnd; ++it) diff --git a/include/internal/catch_tag_alias_registry.cpp b/include/internal/catch_tag_alias_registry.cpp index f8c25a10..d0ee2f7c 100644 --- a/include/internal/catch_tag_alias_registry.cpp +++ b/include/internal/catch_tag_alias_registry.cpp @@ -16,7 +16,7 @@ namespace Catch { TagAliasRegistry::~TagAliasRegistry() {} Option TagAliasRegistry::find( std::string const& alias ) const { - std::map::const_iterator it = m_registry.find( alias ); + auto it = m_registry.find( alias ); if( it != m_registry.end() ) return it->second; else diff --git a/include/internal/catch_test_case_tracker.hpp b/include/internal/catch_test_case_tracker.hpp index d03fc936..a7b754c2 100644 --- a/include/internal/catch_test_case_tracker.hpp +++ b/include/internal/catch_test_case_tracker.hpp @@ -167,7 +167,7 @@ namespace TestCaseTracking { } virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override { - Children::const_iterator it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) ); + auto it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) ); return( it != m_children.end() ) ? *it : nullptr; diff --git a/include/reporters/catch_reporter_bases.cpp b/include/reporters/catch_reporter_bases.cpp index b041e526..4e50d6e6 100644 --- a/include/reporters/catch_reporter_bases.cpp +++ b/include/reporters/catch_reporter_bases.cpp @@ -120,7 +120,7 @@ namespace Catch { node = m_rootSection; } else { SectionNode& parentNode = *m_sectionStack.back(); - SectionNode::ChildSections::const_iterator it = + auto it = std::find_if(parentNode.childSections.begin(), parentNode.childSections.end(), BySectionInfo(sectionInfo)); diff --git a/include/reporters/catch_reporter_compact.cpp b/include/reporters/catch_reporter_compact.cpp index 23f043c9..e5b2f5a4 100644 --- a/include/reporters/catch_reporter_compact.cpp +++ b/include/reporters/catch_reporter_compact.cpp @@ -217,7 +217,7 @@ namespace Catch { if ( itMessage == messages.end() ) return; - // using messages.end() directly yields compilation error: + // using messages.end() directly yields (or auto) compilation error: std::vector::const_iterator itEnd = messages.end(); const std::size_t N = static_cast( std::distance( itMessage, itEnd ) ); diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp index 9c18e6c5..bbfc151e 100644 --- a/include/reporters/catch_reporter_console.cpp +++ b/include/reporters/catch_reporter_console.cpp @@ -274,7 +274,7 @@ namespace Catch { if( m_sectionStack.size() > 1 ) { Colour colourGuard( Colour::Headers ); - std::vector::const_iterator + auto it = m_sectionStack.begin()+1, // Skip first section (test case) itEnd = m_sectionStack.end(); for( ; it != itEnd; ++it ) diff --git a/include/reporters/catch_reporter_tap.hpp b/include/reporters/catch_reporter_tap.hpp index b34acac3..0101fdab 100644 --- a/include/reporters/catch_reporter_tap.hpp +++ b/include/reporters/catch_reporter_tap.hpp @@ -205,7 +205,7 @@ namespace Catch { return; } - // using messages.end() directly yields compilation error: + // using messages.end() directly (or auto) yields compilation error: std::vector::const_iterator itEnd = messages.end(); const std::size_t N = static_cast( std::distance( itMessage, itEnd ) );