Title
Missing string_type member typedef in class sub_match
Status
c++11
Section
[re.submatch.members]
Submitter
Daniel Krügler

Created on 2009-07-25.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. In the class template sub_match synopsis [re.submatch]/1 change as indicated:

    template <class BidirectionalIterator>
    class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator> {
    public:
      typedef typename iterator_traits<BidirectionalIterator>::value_type value_type;
      typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
      typedef BidirectionalIterator iterator;
      typedef basic_string<value_type> string_type;
    
      bool matched;
    
      difference_type length() const;
      operator basic_string<value_type>string_type() const;
      basic_string<value_type>string_type str() const;
      int compare(const sub_match& s) const;
      int compare(const basic_string<value_type>string_type& s) const;
      int compare(const value_type* s) const;
    };
    
  2. In [re.submatch.members]/2 change as indicated:

    operator basic_string<value_type>string_type() const;
    

    Returns: matched ? basic_string<value_type> string_type(first, second) : basic_string<value_type> string_type().

  3. In [re.submatch.members]/3 change as indicated:

    basic_string<value_type>string_type str() const;
    

    Returns: matched ? basic_string<value_type> string_type(first, second) : basic_string<value_type> string_type().

  4. In [re.submatch.members]/5 change as indicated:

    int compare(const basic_string<value_type>string_type& s) const;
    
Date: 2009-11-15.00:00:00

[ 2009-11-15 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2009-07-25.00:00:00

The definition of class template sub_match is strongly dependent on the type basic_string<value_type>, both in interface and effects, but does not provide a corresponding typedef string_type, as e.g. class match_results does, which looks like an oversight to me that should be fixed.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg1040
2010-10-21 18:28:33adminsetmessages: + msg1039
2009-07-25 00:00:00admincreate