Fixed const_reverse_iterator compile error with Oracle Solaris Studio 12.1

Building Catch with Oracle Solaris Studio 12.1 generates an error because it is
unable to convert from a std::vector<>::reverse_iterator to a
std::vector<>::const_reverse_iterator.  This is easily avoided by using a
constant reference to the type before obtaining the iterator.
This commit is contained in:
Andrew Foster 2016-10-10 11:21:22 +01:00
parent 88732e85b2
commit 71b969dec9

View File

@ -327,8 +327,9 @@ namespace Catch {
void 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<SectionEndInfo>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
itEnd = m_unfinishedSections.rend();
std::vector<SectionEndInfo> const& constUnfinishedSections = m_unfinishedSections;
for( std::vector<SectionEndInfo>::const_reverse_iterator it = constUnfinishedSections.rbegin(),
itEnd = constUnfinishedSections.rend();
it != itEnd;
++it )
sectionEnded( *it );