From Jason Turner

[depr.conversions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpszy6eo4y/{from.md → to.md} +18 -101
tmp/tmpszy6eo4y/{from.md → to.md} RENAMED
@@ -3,12 +3,12 @@
3
  The header `<locale>` has the following additions:
4
 
5
  ``` cpp
6
  namespace std {
7
  template<class Codecvt, class Elem = wchar_t,
8
- class Wide_alloc = allocator<Elem>,
9
- class Byte_alloc = allocator<char>>
10
  class wstring_convert;
11
 
12
  template<class Codecvt, class Elem = wchar_t,
13
  class Tr = char_traits<Elem>>
14
  class wbuffer_convert;
@@ -38,20 +38,21 @@ std::cout << mbstring;
38
  — *end example*]
39
 
40
  ``` cpp
41
  namespace std {
42
  template<class Codecvt, class Elem = wchar_t,
43
- class Wide_alloc = allocator<Elem>,
44
- class Byte_alloc = allocator<char>>
45
  class wstring_convert {
46
  public:
47
- using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;
48
- using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;
49
  using state_type = typename Codecvt::state_type;
50
  using int_type = typename wide_string::traits_type::int_type;
51
 
52
- explicit wstring_convert(Codecvt* pcvt = new Codecvt);
 
53
  wstring_convert(Codecvt* pcvt, state_type state);
54
  explicit wstring_convert(const byte_string& byte_err,
55
  const wide_string& wide_err = wide_string());
56
  ~wstring_convert();
57
 
@@ -81,12 +82,12 @@ namespace std {
81
  }
82
  ```
83
 
84
  The class template describes an object that controls conversions between
85
  wide string objects of class `basic_string<Elem, char_traits<Elem>,
86
- Wide_alloc>` and byte string objects of class `basic_string<char,
87
- char_traits<char>, Byte_alloc>`. The class template defines the types
88
  `wide_string` and `byte_string` as synonyms for these two types.
89
  Conversion between a sequence of `Elem` values (stored in a
90
  `wide_string` object) and multibyte sequences (stored in a `byte_string`
91
  object) is performed by an object of class `Codecvt`, which meets the
92
  requirements of the standard code-conversion facet `codecvt<Elem,
@@ -100,15 +101,15 @@ An object of this class template stores:
100
  freed when the `wstring_convert` object is destroyed)
101
  - `cvtstate` — a conversion state object
102
  - `cvtcount` — a conversion count
103
 
104
  ``` cpp
105
- using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;
106
  ```
107
 
108
  The type shall be a synonym for
109
- `basic_string<char, char_traits<char>, Byte_alloc>`.
110
 
111
  ``` cpp
112
  size_t converted() const noexcept;
113
  ```
114
 
@@ -187,18 +188,18 @@ return the converted byte string. Otherwise, if the object was
187
  constructed with a byte-error string, the member function shall return
188
  the byte-error string. Otherwise, the member function shall throw an
189
  object of class `range_error`.
190
 
191
  ``` cpp
192
- using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;
193
  ```
194
 
195
  The type shall be a synonym for
196
- `basic_string<Elem, char_traits<Elem>, Wide_alloc>`.
197
 
198
  ``` cpp
199
- explicit wstring_convert(Codecvt* pcvt = new Codecvt);
200
  wstring_convert(Codecvt* pcvt, state_type state);
201
  explicit wstring_convert(const byte_string& byte_err,
202
  const wide_string& wide_err = wide_string());
203
  ```
204
 
@@ -232,11 +233,12 @@ namespace std {
232
  template<class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
233
  class wbuffer_convert : public basic_streambuf<Elem, Tr> {
234
  public:
235
  using state_type = typename Codecvt::state_type;
236
 
237
- explicit wbuffer_convert(streambuf* bytebuf = 0,
 
238
  Codecvt* pcvt = new Codecvt,
239
  state_type state = state_type());
240
 
241
  ~wbuffer_convert();
242
 
@@ -297,11 +299,11 @@ using state_type = typename Codecvt::state_type;
297
 
298
  The type shall be a synonym for `Codecvt::state_type`.
299
 
300
  ``` cpp
301
  explicit wbuffer_convert(
302
- streambuf* bytebuf = 0,
303
  Codecvt* pcvt = new Codecvt,
304
  state_type state = state_type());
305
  ```
306
 
307
  *Requires:* `pcvt != nullptr`.
@@ -314,90 +316,5 @@ initializes `cvtstate` to `state`.
314
  ~wbuffer_convert();
315
  ```
316
 
317
  *Effects:* The destructor shall delete `cvtptr`.
318
 
319
- <!-- Link reference definitions -->
320
- [basic.align]: basic.md#basic.align
321
- [basic.scope.namespace]: basic.md#basic.scope.namespace
322
- [basic.types]: basic.md#basic.types
323
- [class.copy]: special.md#class.copy
324
- [class.dtor]: special.md#class.dtor
325
- [cmath.syn]: numerics.md#cmath.syn
326
- [complex.syn]: numerics.md#complex.syn
327
- [containers]: containers.md#containers
328
- [cstddef.syn]: language.md#cstddef.syn
329
- [dcl.attr.deprecated]: dcl.md#dcl.attr.deprecated
330
- [dcl.fct.def]: dcl.md#dcl.fct.def
331
- [default.allocator]: utilities.md#default.allocator
332
- [depr]: #depr
333
- [depr.c.headers]: #depr.c.headers
334
- [depr.ccomplex.syn]: #depr.ccomplex.syn
335
- [depr.codecvt.syn]: #depr.codecvt.syn
336
- [depr.conversions]: #depr.conversions
337
- [depr.conversions.buffer]: #depr.conversions.buffer
338
- [depr.conversions.string]: #depr.conversions.string
339
- [depr.cpp.headers]: #depr.cpp.headers
340
- [depr.cstdalign.syn]: #depr.cstdalign.syn
341
- [depr.cstdbool.syn]: #depr.cstdbool.syn
342
- [depr.ctgmath.syn]: #depr.ctgmath.syn
343
- [depr.default.allocator]: #depr.default.allocator
344
- [depr.except.spec]: #depr.except.spec
345
- [depr.func.adaptor.binding]: #depr.func.adaptor.binding
346
- [depr.func.adaptor.typedefs]: #depr.func.adaptor.typedefs
347
- [depr.impldec]: #depr.impldec
348
- [depr.istrstream]: #depr.istrstream
349
- [depr.istrstream.cons]: #depr.istrstream.cons
350
- [depr.istrstream.members]: #depr.istrstream.members
351
- [depr.iterator.basic]: #depr.iterator.basic
352
- [depr.iterator.primitives]: #depr.iterator.primitives
353
- [depr.locale.stdcvt]: #depr.locale.stdcvt
354
- [depr.locale.stdcvt.req]: #depr.locale.stdcvt.req
355
- [depr.meta.types]: #depr.meta.types
356
- [depr.negators]: #depr.negators
357
- [depr.ostrstream]: #depr.ostrstream
358
- [depr.ostrstream.cons]: #depr.ostrstream.cons
359
- [depr.ostrstream.members]: #depr.ostrstream.members
360
- [depr.static_constexpr]: #depr.static_constexpr
361
- [depr.storage.iterator]: #depr.storage.iterator
362
- [depr.str.strstreams]: #depr.str.strstreams
363
- [depr.strstream]: #depr.strstream
364
- [depr.strstream.cons]: #depr.strstream.cons
365
- [depr.strstream.dest]: #depr.strstream.dest
366
- [depr.strstream.oper]: #depr.strstream.oper
367
- [depr.strstreambuf]: #depr.strstreambuf
368
- [depr.strstreambuf.cons]: #depr.strstreambuf.cons
369
- [depr.strstreambuf.members]: #depr.strstreambuf.members
370
- [depr.strstreambuf.virtuals]: #depr.strstreambuf.virtuals
371
- [depr.temporary.buffer]: #depr.temporary.buffer
372
- [depr.uncaught]: #depr.uncaught
373
- [depr.util.smartptr.shared.obs]: #depr.util.smartptr.shared.obs
374
- [depr.weak.result_type]: #depr.weak.result_type
375
- [expr.unary.op]: expr.md#expr.unary.op
376
- [func.bind.bind]: utilities.md#func.bind.bind
377
- [func.def]: utilities.md#func.def
378
- [function.objects]: utilities.md#function.objects
379
- [meta.rqmts]: utilities.md#meta.rqmts
380
- [namespace.udecl]: dcl.md#namespace.udecl
381
- [new.delete]: language.md#new.delete
382
- [output.iterators]: iterators.md#output.iterators
383
- [sf.cmath]: numerics.md#sf.cmath
384
- [support.types.byteops]: language.md#support.types.byteops
385
- [tab:future.c.headers]: #tab:future.c.headers
386
- [tab:future.newoff.values]: #tab:future.newoff.values
387
- [tab:future.seekoff.positioning]: #tab:future.seekoff.positioning
388
- [tab:future.strstreambuf.effects]: #tab:future.strstreambuf.effects
389
- [tab:future.strstreambuf1.effects]: #tab:future.strstreambuf1.effects
390
- [tab:future.strstreambuf2.effects]: #tab:future.strstreambuf2.effects
391
- [temp.deduct]: temp.md#temp.deduct
392
- [unord.hash]: utilities.md#unord.hash
393
- [util.smartptr.shared]: utilities.md#util.smartptr.shared
394
-
395
- [^1]: The function signature `strlen(const char*)` is declared in
396
- `<cstring>` ([[cstring.syn]]). The macro `INT_MAX` is defined in
397
- `<climits>` ([[climits.syn]]).
398
-
399
- [^2]: An implementation should consider `alsize` in making this
400
- decision.
401
-
402
- [^3]: The function signature `strlen(const char*)` is declared in
403
- `<cstring>` ([[cstring.syn]]).
 
3
  The header `<locale>` has the following additions:
4
 
5
  ``` cpp
6
  namespace std {
7
  template<class Codecvt, class Elem = wchar_t,
8
+ class WideAlloc = allocator<Elem>,
9
+ class ByteAlloc = allocator<char>>
10
  class wstring_convert;
11
 
12
  template<class Codecvt, class Elem = wchar_t,
13
  class Tr = char_traits<Elem>>
14
  class wbuffer_convert;
 
38
  — *end example*]
39
 
40
  ``` cpp
41
  namespace std {
42
  template<class Codecvt, class Elem = wchar_t,
43
+ class WideAlloc = allocator<Elem>,
44
+ class ByteAlloc = allocator<char>>
45
  class wstring_convert {
46
  public:
47
+ using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
48
+ using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
49
  using state_type = typename Codecvt::state_type;
50
  using int_type = typename wide_string::traits_type::int_type;
51
 
52
+ wstring_convert() : wstring_convert(new Codecvt) {}
53
+ explicit wstring_convert(Codecvt* pcvt);
54
  wstring_convert(Codecvt* pcvt, state_type state);
55
  explicit wstring_convert(const byte_string& byte_err,
56
  const wide_string& wide_err = wide_string());
57
  ~wstring_convert();
58
 
 
82
  }
83
  ```
84
 
85
  The class template describes an object that controls conversions between
86
  wide string objects of class `basic_string<Elem, char_traits<Elem>,
87
+ WideAlloc>` and byte string objects of class `basic_string<char,
88
+ char_traits<char>, ByteAlloc>`. The class template defines the types
89
  `wide_string` and `byte_string` as synonyms for these two types.
90
  Conversion between a sequence of `Elem` values (stored in a
91
  `wide_string` object) and multibyte sequences (stored in a `byte_string`
92
  object) is performed by an object of class `Codecvt`, which meets the
93
  requirements of the standard code-conversion facet `codecvt<Elem,
 
101
  freed when the `wstring_convert` object is destroyed)
102
  - `cvtstate` — a conversion state object
103
  - `cvtcount` — a conversion count
104
 
105
  ``` cpp
106
+ using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
107
  ```
108
 
109
  The type shall be a synonym for
110
+ `basic_string<char, char_traits<char>, ByteAlloc>`.
111
 
112
  ``` cpp
113
  size_t converted() const noexcept;
114
  ```
115
 
 
188
  constructed with a byte-error string, the member function shall return
189
  the byte-error string. Otherwise, the member function shall throw an
190
  object of class `range_error`.
191
 
192
  ``` cpp
193
+ using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
194
  ```
195
 
196
  The type shall be a synonym for
197
+ `basic_string<Elem, char_traits<Elem>, WideAlloc>`.
198
 
199
  ``` cpp
200
+ explicit wstring_convert(Codecvt* pcvt);
201
  wstring_convert(Codecvt* pcvt, state_type state);
202
  explicit wstring_convert(const byte_string& byte_err,
203
  const wide_string& wide_err = wide_string());
204
  ```
205
 
 
233
  template<class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
234
  class wbuffer_convert : public basic_streambuf<Elem, Tr> {
235
  public:
236
  using state_type = typename Codecvt::state_type;
237
 
238
+ wbuffer_convert() : wbuffer_convert(nullptr) {}
239
+ explicit wbuffer_convert(streambuf* bytebuf,
240
  Codecvt* pcvt = new Codecvt,
241
  state_type state = state_type());
242
 
243
  ~wbuffer_convert();
244
 
 
299
 
300
  The type shall be a synonym for `Codecvt::state_type`.
301
 
302
  ``` cpp
303
  explicit wbuffer_convert(
304
+ streambuf* bytebuf,
305
  Codecvt* pcvt = new Codecvt,
306
  state_type state = state_type());
307
  ```
308
 
309
  *Requires:* `pcvt != nullptr`.
 
316
  ~wbuffer_convert();
317
  ```
318
 
319
  *Effects:* The destructor shall delete `cvtptr`.
320