mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 05:45:39 +02:00
Deprecate comparison operators on MessageInfo
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED
|
#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED
|
||||||
#define CATCH_MESSAGE_INFO_HPP_INCLUDED
|
#define CATCH_MESSAGE_INFO_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_deprecation_macro.hpp>
|
||||||
#include <catch2/internal/catch_result_type.hpp>
|
#include <catch2/internal/catch_result_type.hpp>
|
||||||
#include <catch2/internal/catch_source_line_info.hpp>
|
#include <catch2/internal/catch_source_line_info.hpp>
|
||||||
#include <catch2/internal/catch_stringref.hpp>
|
#include <catch2/internal/catch_stringref.hpp>
|
||||||
@@ -27,9 +28,11 @@ namespace Catch {
|
|||||||
ResultWas::OfType type;
|
ResultWas::OfType type;
|
||||||
unsigned int sequence;
|
unsigned int sequence;
|
||||||
|
|
||||||
|
DEPRECATED( "Explicitly use the 'sequence' member instead" )
|
||||||
bool operator == (MessageInfo const& other) const {
|
bool operator == (MessageInfo const& other) const {
|
||||||
return sequence == other.sequence;
|
return sequence == other.sequence;
|
||||||
}
|
}
|
||||||
|
DEPRECATED( "Explicitly use the 'sequence' member instead" )
|
||||||
bool operator < (MessageInfo const& other) const {
|
bool operator < (MessageInfo const& other) const {
|
||||||
return sequence < other.sequence;
|
return sequence < other.sequence;
|
||||||
}
|
}
|
||||||
|
@@ -439,8 +439,14 @@ namespace Catch {
|
|||||||
m_messages.push_back(message);
|
m_messages.push_back(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::popScopedMessage(MessageInfo const & message) {
|
void RunContext::popScopedMessage( MessageInfo const& message ) {
|
||||||
m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());
|
m_messages.erase(
|
||||||
|
std::remove_if( m_messages.begin(),
|
||||||
|
m_messages.end(),
|
||||||
|
[id = message.sequence]( MessageInfo const& msg ) {
|
||||||
|
return msg.sequence == id;
|
||||||
|
} ),
|
||||||
|
m_messages.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::emplaceUnscopedMessage( MessageBuilder&& builder ) {
|
void RunContext::emplaceUnscopedMessage( MessageBuilder&& builder ) {
|
||||||
|
Reference in New Issue
Block a user