diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 1de4778e..8d44b408 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -303,9 +303,14 @@ namespace Catch std::string stdOut; std::string stdErr; }; - friend bool operator == ( Ptr const& node, SectionInfo const& other ) { - return node->stats.sectionInfo.lineInfo == other.lineInfo; - } + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : other( other ) {} + bool operator() ( Ptr const& node ) const { + return node->stats.sectionInfo.lineInfo == other.lineInfo; + } + private: + SectionInfo const& other; + }; typedef Node TestCaseNode; typedef Node TestGroupNode; @@ -333,7 +338,8 @@ namespace Catch else { SectionNode& parentNode = *m_sectionStack.back(); SectionNode::ChildSections::const_iterator it = - std::find( parentNode.childSections.begin(), parentNode.childSections.end(), sectionInfo ); + std::find_if( parentNode.childSections.begin(), parentNode.childSections.end(), + BySectionInfo(sectionInfo) ); if( it == parentNode.childSections.end() ) { node = new SectionNode( incompleteStats ); parentNode.childSections.push_back( node );