From Jason Turner

[re.traits]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwkn8zbk4/{from.md → to.md} +15 -17
tmp/tmpwkn8zbk4/{from.md → to.md} RENAMED
@@ -5,11 +5,11 @@ namespace std {
5
  template<class charT>
6
  struct regex_traits {
7
  using char_type = charT;
8
  using string_type = basic_string<char_type>;
9
  using locale_type = locale;
10
- using char_class_type = {bitmask_type};
11
 
12
  regex_traits();
13
  static size_t length(const char_type* p);
14
  charT translate(charT c) const;
15
  charT translate_nocase(charT c) const;
@@ -31,12 +31,11 @@ namespace std {
31
  };
32
  }
33
  ```
34
 
35
  The specializations `regex_traits<char>` and `regex_traits<wchar_t>`
36
- shall be valid and shall satisfy the requirements for a regular
37
- expression traits class ([[re.req]]).
38
 
39
  ``` cpp
40
  using char_class_type = bitmask_type;
41
  ```
42
 
@@ -70,11 +69,11 @@ template <class ForwardIterator>
70
  *Effects:* As if by:
71
 
72
  ``` cpp
73
  string_type str(first, last);
74
  return use_facet<collate<charT>>(
75
- getloc()).transform(&*str.begin(), &*str.begin() + str.length());
76
  ```
77
 
78
  ``` cpp
79
  template<class ForwardIterator>
80
  string_type transform_primary(ForwardIterator first, ForwardIterator last) const;
@@ -94,35 +93,35 @@ returns an empty string.
94
  ``` cpp
95
  template<class ForwardIterator>
96
  string_type lookup_collatename(ForwardIterator first, ForwardIterator last) const;
97
  ```
98
 
99
- *Returns:* a sequence of one or more characters that represents the
100
  collating element consisting of the character sequence designated by the
101
  iterator range \[`first`, `last`). Returns an empty string if the
102
  character sequence is not a valid collating element.
103
 
104
  ``` cpp
105
  template<class ForwardIterator>
106
  char_class_type lookup_classname(
107
  ForwardIterator first, ForwardIterator last, bool icase = false) const;
108
  ```
109
 
110
- *Returns:* an unspecified value that represents the character
111
  classification named by the character sequence designated by the
112
  iterator range \[`first`, `last`). If the parameter `icase` is `true`
113
  then the returned mask identifies the character classification without
114
  regard to the case of the characters being matched, otherwise it does
115
  honor the case of the characters being matched.[^1] The value returned
116
  shall be independent of the case of the characters in the character
117
  sequence. If the name is not recognized then returns
118
  `char_class_type()`.
119
 
120
  *Remarks:* For `regex_traits<char>`, at least the narrow character names
121
- in Table  [[tab:re.traits.classnames]] shall be recognized. For
122
  `regex_traits<wchar_t>`, at least the wide character names in
123
- Table  [[tab:re.traits.classnames]] shall be recognized.
124
 
125
  ``` cpp
126
  bool isctype(charT c, char_class_type f) const;
127
  ```
128
 
@@ -136,13 +135,12 @@ classification represented by `f`.
136
  template<class C>
137
  ctype_base::mask convert(typename regex_traits<C>::char_class_type f);
138
  ```
139
 
140
  that returns a value in which each `ctype_base::mask` value
141
- corresponding to a value in `f` named in
142
- Table  [[tab:re.traits.classnames]] is set, then the result is
143
- determined as if by:
144
 
145
  ``` cpp
146
  ctype_base::mask m = convert<charT>(f);
147
  const ctype<charT>& ct = use_facet<ctype<charT>>(getloc());
148
  if (ct.is(m, c)) {
@@ -186,13 +184,13 @@ t.isctype(' ', f); // returns false
186
 
187
  ``` cpp
188
  int value(charT ch, int radix) const;
189
  ```
190
 
191
- *Requires:* The value of `radix` shall be 8, 10, or 16.
192
 
193
- *Returns:* the value represented by the digit `ch` in base `radix` if
194
  the character `ch` is a valid digit in base `radix`; otherwise returns
195
  `-1`.
196
 
197
  ``` cpp
198
  locale_type imbue(locale_type loc);
@@ -202,25 +200,25 @@ locale_type imbue(locale_type loc);
202
 
203
  [*Note 1*: Calling `imbue` with a different locale than the one
204
  currently in use invalidates all cached data held by
205
  `*this`. — *end note*]
206
 
207
- *Returns:* if no locale has been previously imbued then a copy of the
208
  global locale in effect at the time of construction of `*this`,
209
  otherwise a copy of the last argument passed to `imbue`.
210
 
211
- *Postconditions:* `getloc() == loc`.
212
 
213
  ``` cpp
214
  locale_type getloc() const;
215
  ```
216
 
217
- *Returns:* if no locale has been imbued then a copy of the global locale
218
  in effect at the time of construction of `*this`, otherwise a copy of
219
  the last argument passed to `imbue`.
220
 
221
- **Table: Character class names and corresponding `ctype` masks** <a id="tab:re.traits.classnames">[tab:re.traits.classnames]</a>
222
 
223
  | Narrow character name | Wide character name | Corresponding `ctype_base::mask` value |
224
  | --------------------- | ------------------- | -------------------------------------- |
225
  | `"alnum"` | `L"alnum"` | `ctype_base::alnum` |
226
  | `"alpha"` | `L"alpha"` | `ctype_base::alpha` |
 
5
  template<class charT>
6
  struct regex_traits {
7
  using char_type = charT;
8
  using string_type = basic_string<char_type>;
9
  using locale_type = locale;
10
+ using char_class_type = bitmask_type;
11
 
12
  regex_traits();
13
  static size_t length(const char_type* p);
14
  charT translate(charT c) const;
15
  charT translate_nocase(charT c) const;
 
31
  };
32
  }
33
  ```
34
 
35
  The specializations `regex_traits<char>` and `regex_traits<wchar_t>`
36
+ meet the requirements for a regular expression traits class [[re.req]].
 
37
 
38
  ``` cpp
39
  using char_class_type = bitmask_type;
40
  ```
41
 
 
69
  *Effects:* As if by:
70
 
71
  ``` cpp
72
  string_type str(first, last);
73
  return use_facet<collate<charT>>(
74
+ getloc()).transform(str.data(), str.data() + str.length());
75
  ```
76
 
77
  ``` cpp
78
  template<class ForwardIterator>
79
  string_type transform_primary(ForwardIterator first, ForwardIterator last) const;
 
93
  ``` cpp
94
  template<class ForwardIterator>
95
  string_type lookup_collatename(ForwardIterator first, ForwardIterator last) const;
96
  ```
97
 
98
+ *Returns:* A sequence of one or more characters that represents the
99
  collating element consisting of the character sequence designated by the
100
  iterator range \[`first`, `last`). Returns an empty string if the
101
  character sequence is not a valid collating element.
102
 
103
  ``` cpp
104
  template<class ForwardIterator>
105
  char_class_type lookup_classname(
106
  ForwardIterator first, ForwardIterator last, bool icase = false) const;
107
  ```
108
 
109
+ *Returns:* An unspecified value that represents the character
110
  classification named by the character sequence designated by the
111
  iterator range \[`first`, `last`). If the parameter `icase` is `true`
112
  then the returned mask identifies the character classification without
113
  regard to the case of the characters being matched, otherwise it does
114
  honor the case of the characters being matched.[^1] The value returned
115
  shall be independent of the case of the characters in the character
116
  sequence. If the name is not recognized then returns
117
  `char_class_type()`.
118
 
119
  *Remarks:* For `regex_traits<char>`, at least the narrow character names
120
+ in [[re.traits.classnames]] shall be recognized. For
121
  `regex_traits<wchar_t>`, at least the wide character names in
122
+ [[re.traits.classnames]] shall be recognized.
123
 
124
  ``` cpp
125
  bool isctype(charT c, char_class_type f) const;
126
  ```
127
 
 
135
  template<class C>
136
  ctype_base::mask convert(typename regex_traits<C>::char_class_type f);
137
  ```
138
 
139
  that returns a value in which each `ctype_base::mask` value
140
+ corresponding to a value in `f` named in [[re.traits.classnames]] is
141
+ set, then the result is determined as if by:
 
142
 
143
  ``` cpp
144
  ctype_base::mask m = convert<charT>(f);
145
  const ctype<charT>& ct = use_facet<ctype<charT>>(getloc());
146
  if (ct.is(m, c)) {
 
184
 
185
  ``` cpp
186
  int value(charT ch, int radix) const;
187
  ```
188
 
189
+ *Preconditions:* The value of `radix` is 8, 10, or 16.
190
 
191
+ *Returns:* The value represented by the digit `ch` in base `radix` if
192
  the character `ch` is a valid digit in base `radix`; otherwise returns
193
  `-1`.
194
 
195
  ``` cpp
196
  locale_type imbue(locale_type loc);
 
200
 
201
  [*Note 1*: Calling `imbue` with a different locale than the one
202
  currently in use invalidates all cached data held by
203
  `*this`. — *end note*]
204
 
205
+ *Returns:* If no locale has been previously imbued then a copy of the
206
  global locale in effect at the time of construction of `*this`,
207
  otherwise a copy of the last argument passed to `imbue`.
208
 
209
+ *Ensures:* `getloc() == loc`.
210
 
211
  ``` cpp
212
  locale_type getloc() const;
213
  ```
214
 
215
+ *Returns:* If no locale has been imbued then a copy of the global locale
216
  in effect at the time of construction of `*this`, otherwise a copy of
217
  the last argument passed to `imbue`.
218
 
219
+ **Table: Character class names and corresponding `ctype` masks** <a id="re.traits.classnames">[re.traits.classnames]</a>
220
 
221
  | Narrow character name | Wide character name | Corresponding `ctype_base::mask` value |
222
  | --------------------- | ------------------- | -------------------------------------- |
223
  | `"alnum"` | `L"alnum"` | `ctype_base::alnum` |
224
  | `"alpha"` | `L"alpha"` | `ctype_base::alpha` |