From Jason Turner

[re.regex]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps2hgpged/{from.md → to.md} +97 -151
tmp/tmps2hgpged/{from.md → to.md} RENAMED
@@ -12,87 +12,76 @@ converting the sequence of `charT` objects to an internal
12
  representation. It is not specified what form this representation takes,
13
  nor how it is accessed by algorithms that operate on regular
14
  expressions.
15
 
16
  [*Note 1*: Implementations will typically declare some function
17
- templates as friends of `basic_regex` to achieve this — *end note*]
18
 
19
  The functions described in this Clause report errors by throwing
20
  exceptions of type `regex_error`.
21
 
22
  ``` cpp
23
  namespace std {
24
  template<class charT, class traits = regex_traits<charT>>
25
  class basic_regex {
26
  public:
27
- // types:
28
  using value_type = charT;
29
  using traits_type = traits;
30
  using string_type = typename traits::string_type;
31
  using flag_type = regex_constants::syntax_option_type;
32
  using locale_type = typename traits::locale_type;
33
 
34
- // [re.regex.const], constants
35
- static constexpr regex_constants::syntax_option_type
36
- icase = regex_constants::icase;
37
- static constexpr regex_constants::syntax_option_type
38
- nosubs = regex_constants::nosubs;
39
- static constexpr regex_constants::syntax_option_type
40
- optimize = regex_constants::optimize;
41
- static constexpr regex_constants::syntax_option_type
42
- collate = regex_constants::collate;
43
- static constexpr regex_constants::syntax_option_type
44
- ECMAScript = regex_constants::ECMAScript;
45
- static constexpr regex_constants::syntax_option_type
46
- basic = regex_constants::basic;
47
- static constexpr regex_constants::syntax_option_type
48
- extended = regex_constants::extended;
49
- static constexpr regex_constants::syntax_option_type
50
- awk = regex_constants::awk;
51
- static constexpr regex_constants::syntax_option_type
52
- grep = regex_constants::grep;
53
- static constexpr regex_constants::syntax_option_type
54
- egrep = regex_constants::egrep;
55
- static constexpr regex_constants::syntax_option_type
56
- multiline = regex_constants::multiline;
57
 
58
  // [re.regex.construct], construct/copy/destroy
59
  basic_regex();
60
  explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
61
  basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
62
  basic_regex(const basic_regex&);
63
  basic_regex(basic_regex&&) noexcept;
64
  template<class ST, class SA>
65
- explicit basic_regex(const basic_string<charT, ST, SA>& p,
66
  flag_type f = regex_constants::ECMAScript);
67
  template<class ForwardIterator>
68
  basic_regex(ForwardIterator first, ForwardIterator last,
69
  flag_type f = regex_constants::ECMAScript);
70
- basic_regex(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
71
 
72
  ~basic_regex();
73
 
74
- basic_regex& operator=(const basic_regex&);
75
- basic_regex& operator=(basic_regex&&) noexcept;
76
- basic_regex& operator=(const charT* ptr);
77
- basic_regex& operator=(initializer_list<charT> il);
78
- template <class ST, class SA>
79
- basic_regex& operator=(const basic_string<charT, ST, SA>& p);
80
-
81
  // [re.regex.assign], assign
82
- basic_regex& assign(const basic_regex& that);
83
- basic_regex& assign(basic_regex&& that) noexcept;
84
- basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
85
- basic_regex& assign(const charT* p, size_t len, flag_type f);
86
- template <class string_traits, class A>
87
- basic_regex& assign(const basic_string<charT, string_traits, A>& s,
 
 
 
 
 
 
 
88
  flag_type f = regex_constants::ECMAScript);
89
  template<class InputIterator>
90
  basic_regex& assign(InputIterator first, InputIterator last,
91
  flag_type f = regex_constants::ECMAScript);
92
  basic_regex& assign(initializer_list<charT>,
93
- flag_type = regex_constants::ECMAScript);
94
 
95
  // [re.regex.operations], const operations
96
  unsigned mark_count() const;
97
  flag_type flags() const;
98
 
@@ -109,239 +98,198 @@ namespace std {
109
  regex_constants::syntax_option_type = regex_constants::ECMAScript)
110
  -> basic_regex<typename iterator_traits<ForwardIterator>::value_type>;
111
  }
112
  ```
113
 
114
- ### `basic_regex` constants <a id="re.regex.const">[[re.regex.const]]</a>
115
-
116
- ``` cpp
117
- static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
118
- static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
119
- static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
120
- static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
121
- static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
122
- static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
123
- static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
124
- static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
125
- static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
126
- static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
127
- static constexpr regex_constants::syntax_option_type multiline = regex_constants::multiline;
128
- ```
129
-
130
- The static constant members are provided as synonyms for the constants
131
- declared in namespace `regex_constants`.
132
-
133
- ### `basic_regex` constructors <a id="re.regex.construct">[[re.regex.construct]]</a>
134
 
135
  ``` cpp
136
  basic_regex();
137
  ```
138
 
139
- *Effects:* Constructs an object of class `basic_regex` that does not
140
- match any character sequence.
141
 
142
  ``` cpp
143
  explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
144
  ```
145
 
146
- *Requires:* `p` shall not be a null pointer.
 
147
 
148
- *Throws:* `regex_error` if `p` is not a valid regular expression.
 
 
 
149
 
150
- *Effects:* Constructs an object of class `basic_regex`; the object’s
151
- internal finite state machine is constructed from the regular expression
152
- contained in the array of `charT` of length
153
- `char_traits<charT>::length(p)` whose first element is designated by
154
- `p`, and interpreted according to the flags `f`.
155
 
156
- *Postconditions:* `flags()` returns `f`. `mark_count()` returns the
157
- number of marked sub-expressions within the expression.
158
 
159
  ``` cpp
160
- basic_regex(const charT* p, size_t len, flag_type f);
161
  ```
162
 
163
- *Requires:* `p` shall not be a null pointer.
164
 
165
- *Throws:* `regex_error` if `p` is not a valid regular expression.
 
 
166
 
167
- *Effects:* Constructs an object of class `basic_regex`; the object’s
168
- internal finite state machine is constructed from the regular expression
169
- contained in the sequence of characters \[`p`, `p+len`), and interpreted
170
- according the flags specified in `f`.
171
 
172
- *Postconditions:* `flags()` returns `f`. `mark_count()` returns the
173
- number of marked sub-expressions within the expression.
174
 
175
  ``` cpp
176
  basic_regex(const basic_regex& e);
177
  ```
178
 
179
- *Effects:* Constructs an object of class `basic_regex` as a copy of the
180
- object `e`.
181
-
182
- *Postconditions:* `flags()` and `mark_count()` return `e.flags()` and
183
  `e.mark_count()`, respectively.
184
 
185
  ``` cpp
186
  basic_regex(basic_regex&& e) noexcept;
187
  ```
188
 
189
- *Effects:* Move constructs an object of class `basic_regex` from `e`.
190
-
191
- *Postconditions:* `flags()` and `mark_count()` return the values that
192
  `e.flags()` and `e.mark_count()`, respectively, had before construction.
193
- `e` is in a valid state with unspecified value.
194
 
195
  ``` cpp
196
  template<class ST, class SA>
197
  explicit basic_regex(const basic_string<charT, ST, SA>& s,
198
  flag_type f = regex_constants::ECMAScript);
199
  ```
200
 
 
 
 
 
 
 
 
201
  *Throws:* `regex_error` if `s` is not a valid regular expression.
202
 
203
- *Effects:* Constructs an object of class `basic_regex`; the object’s
204
- internal finite state machine is constructed from the regular expression
205
- contained in the string `s`, and interpreted according to the flags
206
- specified in `f`.
207
-
208
- *Postconditions:* `flags()` returns `f`. `mark_count()` returns the
209
- number of marked sub-expressions within the expression.
210
-
211
  ``` cpp
212
  template<class ForwardIterator>
213
  basic_regex(ForwardIterator first, ForwardIterator last,
214
  flag_type f = regex_constants::ECMAScript);
215
  ```
216
 
 
 
 
 
 
 
 
 
217
  *Throws:* `regex_error` if the sequence \[`first`, `last`) is not a
218
  valid regular expression.
219
 
220
- *Effects:* Constructs an object of class `basic_regex`; the object’s
221
- internal finite state machine is constructed from the regular expression
222
- contained in the sequence of characters \[`first`, `last`), and
223
- interpreted according to the flags specified in `f`.
224
-
225
- *Postconditions:* `flags()` returns `f`. `mark_count()` returns the
226
- number of marked sub-expressions within the expression.
227
-
228
  ``` cpp
229
  basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
230
  ```
231
 
232
  *Effects:* Same as `basic_regex(il.begin(), il.end(), f)`.
233
 
234
- ### `basic_regex` assign <a id="re.regex.assign">[[re.regex.assign]]</a>
235
 
236
  ``` cpp
237
  basic_regex& operator=(const basic_regex& e);
238
  ```
239
 
240
- *Effects:* Copies `e` into `*this` and returns `*this`.
241
-
242
- *Postconditions:* `flags()` and `mark_count()` return `e.flags()` and
243
  `e.mark_count()`, respectively.
244
 
245
  ``` cpp
246
  basic_regex& operator=(basic_regex&& e) noexcept;
247
  ```
248
 
249
- *Effects:* Move assigns from `e` into `*this` and returns `*this`.
250
-
251
- *Postconditions:* `flags()` and `mark_count()` return the values that
252
  `e.flags()` and `e.mark_count()`, respectively, had before assignment.
253
  `e` is in a valid state with unspecified value.
254
 
255
  ``` cpp
256
- basic_regex& operator=(const charT* ptr);
257
  ```
258
 
259
- *Requires:* `ptr` shall not be a null pointer.
260
-
261
- *Effects:* Returns `assign(ptr)`.
262
 
263
  ``` cpp
264
  basic_regex& operator=(initializer_list<charT> il);
265
  ```
266
 
267
- *Effects:* Returns `assign(il.begin(), il.end())`.
268
 
269
  ``` cpp
270
  template<class ST, class SA>
271
- basic_regex& operator=(const basic_string<charT, ST, SA>& p);
272
  ```
273
 
274
- *Effects:* Returns `assign(p)`.
275
 
276
  ``` cpp
277
- basic_regex& assign(const basic_regex& that);
278
  ```
279
 
280
- *Effects:* Equivalent to `*this = that`.
281
-
282
- *Returns:* `*this`.
283
 
284
  ``` cpp
285
- basic_regex& assign(basic_regex&& that) noexcept;
286
  ```
287
 
288
- *Effects:* Equivalent to `*this = std::move(that)`.
289
-
290
- *Returns:* `*this`.
291
 
292
  ``` cpp
293
- basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
294
  ```
295
 
296
- *Returns:* `assign(string_type(ptr), f)`.
297
 
298
  ``` cpp
299
- basic_regex& assign(const charT* ptr, size_t len, flag_type f = regex_constants::ECMAScript);
300
  ```
301
 
302
- *Returns:* `assign(string_type(ptr, len), f)`.
303
 
304
  ``` cpp
305
- template <class string_traits, class A>
306
- basic_regex& assign(const basic_string<charT, string_traits, A>& s,
307
  flag_type f = regex_constants::ECMAScript);
308
  ```
309
 
310
- *Throws:* `regex_error` if `s` is not a valid regular expression.
311
-
312
  *Returns:* `*this`.
313
 
314
  *Effects:* Assigns the regular expression contained in the string `s`,
315
  interpreted according the flags specified in `f`. If an exception is
316
  thrown, `*this` is unchanged.
317
 
318
- *Postconditions:* If no exception is thrown, `flags()` returns `f` and
319
  `mark_count()` returns the number of marked sub-expressions within the
320
  expression.
321
 
 
 
322
  ``` cpp
323
  template<class InputIterator>
324
  basic_regex& assign(InputIterator first, InputIterator last,
325
  flag_type f = regex_constants::ECMAScript);
326
  ```
327
 
328
- *Requires:* The type `InputIterator` shall satisfy the requirements for
329
- an Input Iterator ([[input.iterators]]).
330
-
331
- *Returns:* `assign(string_type(first, last), f)`.
332
 
333
  ``` cpp
334
  basic_regex& assign(initializer_list<charT> il,
335
  flag_type f = regex_constants::ECMAScript);
336
  ```
337
 
338
- *Effects:* Same as `assign(il.begin(), il.end(), f)`.
339
 
340
- *Returns:* `*this`.
341
-
342
- ### `basic_regex` constant operations <a id="re.regex.operations">[[re.regex.operations]]</a>
343
 
344
  ``` cpp
345
  unsigned mark_count() const;
346
  ```
347
 
@@ -353,11 +301,11 @@ flag_type flags() const;
353
  ```
354
 
355
  *Effects:* Returns a copy of the regular expression syntax flags that
356
  were passed to the object’s constructor or to the last call to `assign`.
357
 
358
- ### `basic_regex` locale <a id="re.regex.locale">[[re.regex.locale]]</a>
359
 
360
  ``` cpp
361
  locale_type imbue(locale_type loc);
362
  ```
363
 
@@ -372,26 +320,24 @@ locale_type getloc() const;
372
 
373
  *Effects:* Returns the result of `traits_inst.getloc()` where
374
  `traits_inst` is a (default-initialized) instance of the template
375
  parameter `traits` stored within the object.
376
 
377
- ### `basic_regex` swap <a id="re.regex.swap">[[re.regex.swap]]</a>
378
 
379
  ``` cpp
380
  void swap(basic_regex& e);
381
  ```
382
 
383
  *Effects:* Swaps the contents of the two regular expressions.
384
 
385
- *Postconditions:* `*this` contains the regular expression that was in
386
- `e`, `e` contains the regular expression that was in `*this`.
387
 
388
  *Complexity:* Constant time.
389
 
390
- ### `basic_regex` non-member functions <a id="re.regex.nonmemb">[[re.regex.nonmemb]]</a>
391
-
392
- #### `basic_regex` non-member swap <a id="re.regex.nmswap">[[re.regex.nmswap]]</a>
393
 
394
  ``` cpp
395
  template<class charT, class traits>
396
  void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs);
397
  ```
 
12
  representation. It is not specified what form this representation takes,
13
  nor how it is accessed by algorithms that operate on regular
14
  expressions.
15
 
16
  [*Note 1*: Implementations will typically declare some function
17
+ templates as friends of `basic_regex` to achieve this. — *end note*]
18
 
19
  The functions described in this Clause report errors by throwing
20
  exceptions of type `regex_error`.
21
 
22
  ``` cpp
23
  namespace std {
24
  template<class charT, class traits = regex_traits<charT>>
25
  class basic_regex {
26
  public:
27
+ // types
28
  using value_type = charT;
29
  using traits_type = traits;
30
  using string_type = typename traits::string_type;
31
  using flag_type = regex_constants::syntax_option_type;
32
  using locale_type = typename traits::locale_type;
33
 
34
+ // [re.synopt], constants
35
+ static constexpr flag_type icase = regex_constants::icase;
36
+ static constexpr flag_type nosubs = regex_constants::nosubs;
37
+ static constexpr flag_type optimize = regex_constants::optimize;
38
+ static constexpr flag_type collate = regex_constants::collate;
39
+ static constexpr flag_type ECMAScript = regex_constants::ECMAScript;
40
+ static constexpr flag_type basic = regex_constants::basic;
41
+ static constexpr flag_type extended = regex_constants::extended;
42
+ static constexpr flag_type awk = regex_constants::awk;
43
+ static constexpr flag_type grep = regex_constants::grep;
44
+ static constexpr flag_type egrep = regex_constants::egrep;
45
+ static constexpr flag_type multiline = regex_constants::multiline;
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  // [re.regex.construct], construct/copy/destroy
48
  basic_regex();
49
  explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
50
  basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
51
  basic_regex(const basic_regex&);
52
  basic_regex(basic_regex&&) noexcept;
53
  template<class ST, class SA>
54
+ explicit basic_regex(const basic_string<charT, ST, SA>& s,
55
  flag_type f = regex_constants::ECMAScript);
56
  template<class ForwardIterator>
57
  basic_regex(ForwardIterator first, ForwardIterator last,
58
  flag_type f = regex_constants::ECMAScript);
59
+ basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
60
 
61
  ~basic_regex();
62
 
 
 
 
 
 
 
 
63
  // [re.regex.assign], assign
64
+ basic_regex& operator=(const basic_regex& e);
65
+ basic_regex& operator=(basic_regex&& e) noexcept;
66
+ basic_regex& operator=(const charT* p);
67
+ basic_regex& operator=(initializer_list<charT> il);
68
+ template<class ST, class SA>
69
+ basic_regex& operator=(const basic_string<charT, ST, SA>& s);
70
+
71
+ basic_regex& assign(const basic_regex& e);
72
+ basic_regex& assign(basic_regex&& e) noexcept;
73
+ basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript);
74
+ basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
75
+ template<class ST, class SA>
76
+ basic_regex& assign(const basic_string<charT, ST, SA>& s,
77
  flag_type f = regex_constants::ECMAScript);
78
  template<class InputIterator>
79
  basic_regex& assign(InputIterator first, InputIterator last,
80
  flag_type f = regex_constants::ECMAScript);
81
  basic_regex& assign(initializer_list<charT>,
82
+ flag_type f = regex_constants::ECMAScript);
83
 
84
  // [re.regex.operations], const operations
85
  unsigned mark_count() const;
86
  flag_type flags() const;
87
 
 
98
  regex_constants::syntax_option_type = regex_constants::ECMAScript)
99
  -> basic_regex<typename iterator_traits<ForwardIterator>::value_type>;
100
  }
101
  ```
102
 
103
+ ### Constructors <a id="re.regex.construct">[[re.regex.construct]]</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  ``` cpp
106
  basic_regex();
107
  ```
108
 
109
+ *Ensures:* `*this` does not match any character sequence.
 
110
 
111
  ``` cpp
112
  explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
113
  ```
114
 
115
+ *Preconditions:* \[`p`, `p + char_traits<charT>::length(p)`) is a valid
116
+ range.
117
 
118
+ *Effects:* The object’s internal finite state machine is constructed
119
+ from the regular expression contained in the sequence of characters
120
+ \[`p`, `p + char_traits<charT>::length(p)`), and interpreted according
121
+ to the flags `f`.
122
 
123
+ *Ensures:* `flags()` returns `f`. `mark_count()` returns the number of
124
+ marked sub-expressions within the expression.
 
 
 
125
 
126
+ *Throws:* `regex_error` if \[`p`, `p + char_traits<charT>::length(p)`)
127
+ is not a valid regular expression.
128
 
129
  ``` cpp
130
+ basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
131
  ```
132
 
133
+ *Preconditions:* \[`p`, `p + len`) is a valid range.
134
 
135
+ *Effects:* The object’s internal finite state machine is constructed
136
+ from the regular expression contained in the sequence of characters
137
+ \[`p`, `p + len`), and interpreted according the flags specified in `f`.
138
 
139
+ *Ensures:* `flags()` returns `f`. `mark_count()` returns the number of
140
+ marked sub-expressions within the expression.
 
 
141
 
142
+ *Throws:* `regex_error` if \[`p`, `p + len`) is not a valid regular
143
+ expression.
144
 
145
  ``` cpp
146
  basic_regex(const basic_regex& e);
147
  ```
148
 
149
+ *Ensures:* `flags()` and `mark_count()` return `e.flags()` and
 
 
 
150
  `e.mark_count()`, respectively.
151
 
152
  ``` cpp
153
  basic_regex(basic_regex&& e) noexcept;
154
  ```
155
 
156
+ *Ensures:* `flags()` and `mark_count()` return the values that
 
 
157
  `e.flags()` and `e.mark_count()`, respectively, had before construction.
 
158
 
159
  ``` cpp
160
  template<class ST, class SA>
161
  explicit basic_regex(const basic_string<charT, ST, SA>& s,
162
  flag_type f = regex_constants::ECMAScript);
163
  ```
164
 
165
+ *Effects:* The object’s internal finite state machine is constructed
166
+ from the regular expression contained in the string `s`, and interpreted
167
+ according to the flags specified in `f`.
168
+
169
+ *Ensures:* `flags()` returns `f`. `mark_count()` returns the number of
170
+ marked sub-expressions within the expression.
171
+
172
  *Throws:* `regex_error` if `s` is not a valid regular expression.
173
 
 
 
 
 
 
 
 
 
174
  ``` cpp
175
  template<class ForwardIterator>
176
  basic_regex(ForwardIterator first, ForwardIterator last,
177
  flag_type f = regex_constants::ECMAScript);
178
  ```
179
 
180
+ *Effects:* The object’s internal finite state machine is constructed
181
+ from the regular expression contained in the sequence of characters
182
+ \[`first`, `last`), and interpreted according to the flags specified in
183
+ `f`.
184
+
185
+ *Ensures:* `flags()` returns `f`. `mark_count()` returns the number of
186
+ marked sub-expressions within the expression.
187
+
188
  *Throws:* `regex_error` if the sequence \[`first`, `last`) is not a
189
  valid regular expression.
190
 
 
 
 
 
 
 
 
 
191
  ``` cpp
192
  basic_regex(initializer_list<charT> il, flag_type f = regex_constants::ECMAScript);
193
  ```
194
 
195
  *Effects:* Same as `basic_regex(il.begin(), il.end(), f)`.
196
 
197
+ ### Assignment <a id="re.regex.assign">[[re.regex.assign]]</a>
198
 
199
  ``` cpp
200
  basic_regex& operator=(const basic_regex& e);
201
  ```
202
 
203
+ *Ensures:* `flags()` and `mark_count()` return `e.flags()` and
 
 
204
  `e.mark_count()`, respectively.
205
 
206
  ``` cpp
207
  basic_regex& operator=(basic_regex&& e) noexcept;
208
  ```
209
 
210
+ *Ensures:* `flags()` and `mark_count()` return the values that
 
 
211
  `e.flags()` and `e.mark_count()`, respectively, had before assignment.
212
  `e` is in a valid state with unspecified value.
213
 
214
  ``` cpp
215
+ basic_regex& operator=(const charT* p);
216
  ```
217
 
218
+ *Effects:* Equivalent to: `return assign(p);`
 
 
219
 
220
  ``` cpp
221
  basic_regex& operator=(initializer_list<charT> il);
222
  ```
223
 
224
+ *Effects:* Equivalent to: `return assign(il.begin(), il.end());`
225
 
226
  ``` cpp
227
  template<class ST, class SA>
228
+ basic_regex& operator=(const basic_string<charT, ST, SA>& s);
229
  ```
230
 
231
+ *Effects:* Equivalent to: `return assign(s);`
232
 
233
  ``` cpp
234
+ basic_regex& assign(const basic_regex& e);
235
  ```
236
 
237
+ *Effects:* Equivalent to: `return *this = e;`
 
 
238
 
239
  ``` cpp
240
+ basic_regex& assign(basic_regex&& e) noexcept;
241
  ```
242
 
243
+ *Effects:* Equivalent to: `return *this = std::move(e);`
 
 
244
 
245
  ``` cpp
246
+ basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript);
247
  ```
248
 
249
+ *Effects:* Equivalent to: `return assign(string_type(p), f);`
250
 
251
  ``` cpp
252
+ basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
253
  ```
254
 
255
+ *Effects:* Equivalent to: `return assign(string_type(p, len), f);`
256
 
257
  ``` cpp
258
+ template<class ST, class SA>
259
+ basic_regex& assign(const basic_string<charT, ST, SA>& s,
260
  flag_type f = regex_constants::ECMAScript);
261
  ```
262
 
 
 
263
  *Returns:* `*this`.
264
 
265
  *Effects:* Assigns the regular expression contained in the string `s`,
266
  interpreted according the flags specified in `f`. If an exception is
267
  thrown, `*this` is unchanged.
268
 
269
+ *Ensures:* If no exception is thrown, `flags()` returns `f` and
270
  `mark_count()` returns the number of marked sub-expressions within the
271
  expression.
272
 
273
+ *Throws:* `regex_error` if `s` is not a valid regular expression.
274
+
275
  ``` cpp
276
  template<class InputIterator>
277
  basic_regex& assign(InputIterator first, InputIterator last,
278
  flag_type f = regex_constants::ECMAScript);
279
  ```
280
 
281
+ *Effects:* Equivalent to: `return assign(string_type(first, last), f);`
 
 
 
282
 
283
  ``` cpp
284
  basic_regex& assign(initializer_list<charT> il,
285
  flag_type f = regex_constants::ECMAScript);
286
  ```
287
 
288
+ *Effects:* Equivalent to: `return assign(il.begin(), il.end(), f);`
289
 
290
+ ### Constant operations <a id="re.regex.operations">[[re.regex.operations]]</a>
 
 
291
 
292
  ``` cpp
293
  unsigned mark_count() const;
294
  ```
295
 
 
301
  ```
302
 
303
  *Effects:* Returns a copy of the regular expression syntax flags that
304
  were passed to the object’s constructor or to the last call to `assign`.
305
 
306
+ ### Locale <a id="re.regex.locale">[[re.regex.locale]]</a>
307
 
308
  ``` cpp
309
  locale_type imbue(locale_type loc);
310
  ```
311
 
 
320
 
321
  *Effects:* Returns the result of `traits_inst.getloc()` where
322
  `traits_inst` is a (default-initialized) instance of the template
323
  parameter `traits` stored within the object.
324
 
325
+ ### Swap <a id="re.regex.swap">[[re.regex.swap]]</a>
326
 
327
  ``` cpp
328
  void swap(basic_regex& e);
329
  ```
330
 
331
  *Effects:* Swaps the contents of the two regular expressions.
332
 
333
+ *Ensures:* `*this` contains the regular expression that was in `e`, `e`
334
+ contains the regular expression that was in `*this`.
335
 
336
  *Complexity:* Constant time.
337
 
338
+ ### Non-member functions <a id="re.regex.nonmemb">[[re.regex.nonmemb]]</a>
 
 
339
 
340
  ``` cpp
341
  template<class charT, class traits>
342
  void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs);
343
  ```