MCPcopy Create free account
hub / github.com/catchorg/Catch2 / removeMessage

Method removeMessage

extras/catch_amalgamated.cpp:6092–6108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6090 }
6091
6092 void removeMessage( unsigned int messageId ) {
6093 // Note: On average, it would probably be better to look for
6094 // the message backwards. However, we do not expect to have
6095 // to deal with more messages than low single digits, so
6096 // the improvement is tiny, and we would have to hand-write
6097 // the loop to avoid terrible codegen of reverse iterators
6098 // in debug mode.
6099 auto iter =
6100 std::find_if( messages.begin(),
6101 messages.end(),
6102 [messageId]( MessageInfo const& msg ) {
6103 return msg.sequence == messageId;
6104 } );
6105 assert( iter != messages.end() &&
6106 "Trying to remove non-existent message." );
6107 messages.erase( iter );
6108 }
6109
6110 void removeUnscopedMessages() {
6111 for ( const auto messageId : unscoped_ids ) {

Callers 1

popScopedMessageFunction · 0.45

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected