Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-07-21 11:53:00 +0200
committerMartin Hořeňovský2025-07-21 21:50:45 +0200
commit98b4bbb35efc3937b24e1de5559c974bd2578a14 (patch)
tree5a76fc5456e8387a01b67ccd9afde2bd47f54b55 /src
parent8c3ffe05e1293e64c8d10bcd68092fe9de9673ff (diff)
downloadcatch3-98b4bbb35efc3937b24e1de5559c974bd2578a14.tar.gz
Deprecate comparison operators on MessageInfo
Diffstat (limited to 'src')
-rw-r--r--src/catch2/internal/catch_message_info.hpp3
-rw-r--r--src/catch2/internal/catch_run_context.cpp10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/catch2/internal/catch_message_info.hpp b/src/catch2/internal/catch_message_info.hpp
index 1ef43fda..ded098f5 100644
--- a/src/catch2/internal/catch_message_info.hpp
+++ b/src/catch2/internal/catch_message_info.hpp
@@ -8,6 +8,7 @@
#ifndef 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_source_line_info.hpp>
#include <catch2/internal/catch_stringref.hpp>
@@ -27,9 +28,11 @@ namespace Catch {
ResultWas::OfType type;
unsigned int sequence;
+ DEPRECATED( "Explicitly use the 'sequence' member instead" )
bool operator == (MessageInfo const& other) const {
return sequence == other.sequence;
}
+ DEPRECATED( "Explicitly use the 'sequence' member instead" )
bool operator < (MessageInfo const& other) const {
return sequence < other.sequence;
}
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index ae170d1f..a6b99c02 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -439,8 +439,14 @@ namespace Catch {
m_messages.push_back(message);
}
- void RunContext::popScopedMessage(MessageInfo const & message) {
- m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());
+ void RunContext::popScopedMessage( MessageInfo const& message ) {
+ 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 ) {