2002. Class template match_results does not specify the semantics of operator==

Section: 31.10.8 [re.results.nonmember] Status: Resolved Submitter: Daniel Krügler Opened: 2010-10-24 Last modified: 2016-02-10

Priority: Not Prioritized

View all issues with Resolved status.

Discussion:

The Returns element of operator== says:

true only if the two objects refer to the same match

It is not really clear what this means: The current specification would allow for an implementation to return true, only if the address values of m1 and m2 are the same. While this approach is unproblematic in terms of used operations this is also a bit unsatisfactory. With identity equality alone there seems to be no convincing reason to provide this operator at all. It could for example also refer to an comparison based on iterator values. In this case a user should better know that this will be done, because there is no guarantee at all that inter-container comparison of iterators is a feasible operation. This was a clear outcome of the resolution provided in N3066 for LWG issue 446. It could also mean that a character-based comparison of the individual sub_match elements should be done - this would be equivalent to applying operator== to the subexpressions, prefix and suffix.

Proposed resolution:

Addressed by paper n3158.