Title
Class template basic_regex uses non existent string_type
Status
c++11
Section
[re.regex.assign]
Submitter
Volker Lukas

Created on 2010-10-21.00:00:00 last changed 162 months ago

Messages

Date: 2011-02-24.19:33:19

Proposed resolution:

Change the class template basic_regex synopsis, [re.regex] p. 3, as indicated:

namespace std {
  template <class charT,
            class traits = regex_traits<charT> >
  class basic_regex {
  public:
    // types:
    typedef charT value_type;
    typedef traits traits_type;
    typedef typename traits::string_type string_type;
    typedef regex_constants::syntax_option_type flag_type;
    typedef typename traits::locale_type locale_type;

    [..]
  };
}
Date: 2011-02-24.00:00:00

[ 2011-02-24 Reflector discussion ]

Moved to Tentatively Ready after 6 votes.

Date: 2011-02-16.00:00:00

[ 2011-02-16: Daniel comments and provides an alternative resolution. ]

I'm strongly in favour with the Batavia idea to provide a separate string_type within basic_regex, but it seems to me that the issue resultion should add one more important typedef, namely that of the traits type! Currently, basic_regex is the only template that does not publish the type of the associated traits type. Instead of opening a new issue, I added this suggestion as part of the proposed wording.

Date: 2010-11-13.23:03:59

[ 2010 Batavia ]

Unsure if we should just give basic_regex a string_type typedef. Looking for when string_type was introduced into regex. Howard to draft wording for typedef typename traits::string_type string_type, then move to Review.

Date: 2010-11-03.00:00:00

[ 2010-11-03 Daniel comments and suggests alternative wording: ]

The proposed resolution needs to use basic_string<charT> instead of basic_string<char>

Previous Proposed Resolution:

Make the following changes to [re.regex.assign]:

basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);

12 Returns: assign(string_typebasic_string<charT>(ptr), f).

basic_regex& assign(const charT* ptr, size_t len,
  flag_type f = regex_constants::ECMAScript);

13 Returns: assign(string_typebasic_string<charT>(ptr, len), f).

[..]

template <class InputIterator> 
  basic_regex& assign(InputIterator first, InputIterator last, 
                          flag_type f = regex_constants::ECMAScript);

18 Requires: The type InputIterator shall satisfy the requirements for an Input Iterator (24.2.3).

19 Returns: assign(string_typebasic_string<charT>(first, last), f).

Date: 2010-10-21.00:00:00

In working draft N3126, subclause [re.regex.assign], paragraphs 12, 13 and 19, the name string_type is used. This is presumably a typedef for basic_string<value_type>, where value_type is the character type used by basic_regex. The basic_regex template however defines no such typedef, and neither does the <regex> header or the <initializer_list> header included by <regex>.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2011-02-24 19:33:19adminsetmessages: + msg5538
2011-02-24 19:33:19adminsetstatus: open -> ready
2011-02-16 00:03:21adminsetmessages: + msg5492
2010-11-13 23:03:59adminsetmessages: + msg5360
2010-11-13 23:03:59adminsetstatus: new -> open
2010-11-02 20:31:48adminsetmessages: + msg5278
2010-10-23 17:22:18adminsetmessages: + msg4896
2010-10-21 00:00:00admincreate