mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-30 01:03:30 +01:00
Converted a load of spelt out iterators to auto
This commit is contained in:
parent
7ccf11da29
commit
01a21f67f7
@ -277,7 +277,7 @@ namespace Catch {
|
|||||||
void RunContext::handleUnfinishedSections() {
|
void RunContext::handleUnfinishedSections() {
|
||||||
// If sections ended prematurely due to an exception we stored their
|
// If sections ended prematurely due to an exception we stored their
|
||||||
// infos here so we can tear them down outside the unwind process.
|
// infos here so we can tear them down outside the unwind process.
|
||||||
for (std::vector<SectionEndInfo>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
|
for (auto it = m_unfinishedSections.rbegin(),
|
||||||
itEnd = m_unfinishedSections.rend();
|
itEnd = m_unfinishedSections.rend();
|
||||||
it != itEnd;
|
it != itEnd;
|
||||||
++it)
|
++it)
|
||||||
|
@ -16,7 +16,7 @@ namespace Catch {
|
|||||||
TagAliasRegistry::~TagAliasRegistry() {}
|
TagAliasRegistry::~TagAliasRegistry() {}
|
||||||
|
|
||||||
Option<TagAlias> TagAliasRegistry::find( std::string const& alias ) const {
|
Option<TagAlias> TagAliasRegistry::find( std::string const& alias ) const {
|
||||||
std::map<std::string, TagAlias>::const_iterator it = m_registry.find( alias );
|
auto it = m_registry.find( alias );
|
||||||
if( it != m_registry.end() )
|
if( it != m_registry.end() )
|
||||||
return it->second;
|
return it->second;
|
||||||
else
|
else
|
||||||
|
@ -167,7 +167,7 @@ namespace TestCaseTracking {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override {
|
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() )
|
return( it != m_children.end() )
|
||||||
? *it
|
? *it
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
@ -120,7 +120,7 @@ namespace Catch {
|
|||||||
node = m_rootSection;
|
node = m_rootSection;
|
||||||
} else {
|
} else {
|
||||||
SectionNode& parentNode = *m_sectionStack.back();
|
SectionNode& parentNode = *m_sectionStack.back();
|
||||||
SectionNode::ChildSections::const_iterator it =
|
auto it =
|
||||||
std::find_if(parentNode.childSections.begin(),
|
std::find_if(parentNode.childSections.begin(),
|
||||||
parentNode.childSections.end(),
|
parentNode.childSections.end(),
|
||||||
BySectionInfo(sectionInfo));
|
BySectionInfo(sectionInfo));
|
||||||
|
@ -217,7 +217,7 @@ namespace Catch {
|
|||||||
if ( itMessage == messages.end() )
|
if ( itMessage == messages.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// using messages.end() directly yields compilation error:
|
// using messages.end() directly yields (or auto) compilation error:
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
||||||
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ namespace Catch {
|
|||||||
if( m_sectionStack.size() > 1 ) {
|
if( m_sectionStack.size() > 1 ) {
|
||||||
Colour colourGuard( Colour::Headers );
|
Colour colourGuard( Colour::Headers );
|
||||||
|
|
||||||
std::vector<SectionInfo>::const_iterator
|
auto
|
||||||
it = m_sectionStack.begin()+1, // Skip first section (test case)
|
it = m_sectionStack.begin()+1, // Skip first section (test case)
|
||||||
itEnd = m_sectionStack.end();
|
itEnd = m_sectionStack.end();
|
||||||
for( ; it != itEnd; ++it )
|
for( ; it != itEnd; ++it )
|
||||||
|
@ -205,7 +205,7 @@ namespace Catch {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// using messages.end() directly yields compilation error:
|
// using messages.end() directly (or auto) yields compilation error:
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
||||||
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user