Title
Unclear which members of match_results should be used in comparison
Status
nad editorial
Section
[re.results]
Submitter
Nozomu Katoo

Created on 2007-05-27.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add a new section after [re.results.swap], which reads:

28.10.7 match_results non-member functions.

template<class BidirectionalIterator, class Allocator> 
  bool operator==(const match_results<BidirectionalIterator, Allocator>& m1, 
                  const match_results<BidirectionalIterator, Allocator>& m2);

Returns: true only if the two objects refer to the same match.

template<class BidirectionalIterator, class Allocator> 
  bool operator!=(const match_results<BidirectionalIterator, Allocator>& m1, 
                  const match_results<BidirectionalIterator, Allocator>& m2);

Returns: !(m1 == m2).

template<class BidirectionalIterator, class Allocator> 
  void swap(match_results<BidirectionalIterator, Allocator>& m1, 
            match_results<BidirectionalIterator, Allocator>& m2);

Returns: m1.swap(m2).

Date: 2010-10-21.18:28:33

[ Kona (2007): Bill and Pete to add minor wording to that proposed in N2409. ]

Date: 2010-10-21.18:28:33

[ John adds: ]

That looks like a bug: operator== should return true only if the two objects refer to the same match - ie if one object was constructed as a copy of the other.

Date: 2007-05-27.00:00:00

In [re.syn] of N2284, two template functions are declared here:

// 28.10, class template match_results: 
  <snip>
// match_results comparisons 
  template <class BidirectionalIterator, class Allocator> 
    bool operator== (const match_results<BidirectionalIterator, Allocator>& m1, 
                     const match_results<BidirectionalIterator, Allocator>& m2); 
  template <class BidirectionalIterator, class Allocator> 
    bool operator!= (const match_results<BidirectionalIterator, Allocator>& m1, 
                     const match_results<BidirectionalIterator, Allocator>& m2); 

// 28.10.6, match_results swap:

But the details of these two bool operator functions (i.e., which members of match_results should be used in comparison) are not described in any following sections.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3434
2010-10-21 18:28:33adminsetmessages: + msg3433
2010-10-21 18:28:33adminsetmessages: + msg3432
2007-05-27 00:00:00admincreate