This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.

645. Missing members in match_results

Section: 32.9 [re.results] Status: NAD Editorial Submitter: Daniel Krügler Opened: 2007-02-26 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [re.results].

View all issues with NAD Editorial status.

Discussion:

According to the description given in 32.9 [re.results]/2 the class template match_results "shall satisfy the requirements of a Sequence, [..], except that only operations defined for const-qualified Sequences are supported". Comparing the provided operations from 32.9 [re.results]/3 with the sequence/container tables 80 and 81 one recognizes the following missing operations:

1) The members

const_iterator rbegin() const;
const_iterator rend() const;

should exists because 23.1/10 demands these for containers (all sequences are containers) which support bidirectional iterators. Aren't these supported by match_result? This is not explicitely expressed, but it's somewhat implied by two arguments:

(a) Several typedefs delegate to iterator_traits<BidirectionalIterator>.

(b) The existence of const_reference operator[](size_type n) const implies even random-access iteration. I also suggest, that match_result should explicitly mention, which minimum iterator category is supported and if this does not include random-access the existence of operator[] is somewhat questionable.

2) The new "convenience" members

const_iterator cbegin() const;
const_iterator cend() const;
const_iterator crbegin() const;
const_iterator crend() const;

should be added according to tables 80/81.

Proposed resolution:

Add the following members to the match_results synopsis after end() in 32.9 [re.results] para 3:

const_iterator cbegin() const; 
const_iterator cend() const;

In section 32.9.5 [re.results.acc] change:

const_iterator begin() const;
const_iterator cbegin() const;

-7- Returns: A starting iterator that enumerates over all the sub-expressions stored in *this.

const_iterator end() const;
const_iterator cend() const;

-8- Returns: A terminating iterator that enumerates over all the sub-expressions stored in *this.

[ Kona (2007): Voted to adopt proposed wording in N2409 except removing the entry in the table container requirements. Moved to Review. ]

[ Bellevue: Proposed wording now in the WP. ]