operator==,!=(std::match_results)
From cppreference.com
< cpp | regex | match results
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
Regular expressions library
Classes
(C++11)
(C++11)
(C++11)
Algorithms
(C++11)
(C++11)
(C++11)
Iterators
(C++11)
(C++11)
Exceptions
(C++11)
Traits
(C++11)
Constants
(C++11)
(C++11)
(C++11)
Regex Grammar
(C++11)
std::match_results
Member functions
State
Element access
Iterators
Format
Modifiers
Non-member functions
operator==operator!=
(until C++20)
Defined in header
<regex>
template< class BidirIt, class Alloc >
(1)
(since C++11)
bool operator==( match_results<BidirIt,Alloc>& lhs,
template< class BidirIt, class Alloc >
(2)
(since C++11) bool operator!=( match_results<BidirIt,Alloc>& lhs,
(until C++20)
Compares two match_results
objects.
Two match_results
are equal if the following conditions are met:
- neither of the objects is ready, or
- both match results are ready and the following conditions are met:
- lhs.empty() and rhs.empty(), or
- !lhs.empty() and !rhs.empty() and the following conditions are met:
- lhs.prefix() == rhs.prefix()
- lhs.size() == rhs.size() && std::equal (lhs.begin(), lhs.end(), rhs.begin())
- lhs.suffix() == rhs.suffix()
1) Checks if lhs and rhs are equal.
2) Checks if lhs and rhs are not equal.
The !=
operator is synthesized from operator==
.
Contents
[edit] Parameters
lhs, rhs
-
match results to compare
Type requirements
-
BidirIt
must meet the requirements of LegacyBidirectionalIterator.
-
Alloc
must meet the requirements of Allocator.
[edit] Return value
1) true if lhs and rhs are equal, false otherwise.
2) true if lhs and rhs are not equal, false otherwise.
[edit] Exceptions
May throw implementation-defined exceptions.
[edit] Example
This section is incomplete
Reason: no example
Reason: no example