From Jason Turner

[depr.conversions.string]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp91xvyx8e/{from.md → to.md} +13 -12
tmp/tmp91xvyx8e/{from.md → to.md} RENAMED
@@ -21,20 +21,21 @@ std::cout << mbstring;
21
  — *end example*]
22
 
23
  ``` cpp
24
  namespace std {
25
  template<class Codecvt, class Elem = wchar_t,
26
- class Wide_alloc = allocator<Elem>,
27
- class Byte_alloc = allocator<char>>
28
  class wstring_convert {
29
  public:
30
- using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;
31
- using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;
32
  using state_type = typename Codecvt::state_type;
33
  using int_type = typename wide_string::traits_type::int_type;
34
 
35
- explicit wstring_convert(Codecvt* pcvt = new Codecvt);
 
36
  wstring_convert(Codecvt* pcvt, state_type state);
37
  explicit wstring_convert(const byte_string& byte_err,
38
  const wide_string& wide_err = wide_string());
39
  ~wstring_convert();
40
 
@@ -64,12 +65,12 @@ namespace std {
64
  }
65
  ```
66
 
67
  The class template describes an object that controls conversions between
68
  wide string objects of class `basic_string<Elem, char_traits<Elem>,
69
- Wide_alloc>` and byte string objects of class `basic_string<char,
70
- char_traits<char>, Byte_alloc>`. The class template defines the types
71
  `wide_string` and `byte_string` as synonyms for these two types.
72
  Conversion between a sequence of `Elem` values (stored in a
73
  `wide_string` object) and multibyte sequences (stored in a `byte_string`
74
  object) is performed by an object of class `Codecvt`, which meets the
75
  requirements of the standard code-conversion facet `codecvt<Elem,
@@ -83,15 +84,15 @@ An object of this class template stores:
83
  freed when the `wstring_convert` object is destroyed)
84
  - `cvtstate` — a conversion state object
85
  - `cvtcount` — a conversion count
86
 
87
  ``` cpp
88
- using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;
89
  ```
90
 
91
  The type shall be a synonym for
92
- `basic_string<char, char_traits<char>, Byte_alloc>`.
93
 
94
  ``` cpp
95
  size_t converted() const noexcept;
96
  ```
97
 
@@ -170,18 +171,18 @@ return the converted byte string. Otherwise, if the object was
170
  constructed with a byte-error string, the member function shall return
171
  the byte-error string. Otherwise, the member function shall throw an
172
  object of class `range_error`.
173
 
174
  ``` cpp
175
- using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;
176
  ```
177
 
178
  The type shall be a synonym for
179
- `basic_string<Elem, char_traits<Elem>, Wide_alloc>`.
180
 
181
  ``` cpp
182
- explicit wstring_convert(Codecvt* pcvt = new Codecvt);
183
  wstring_convert(Codecvt* pcvt, state_type state);
184
  explicit wstring_convert(const byte_string& byte_err,
185
  const wide_string& wide_err = wide_string());
186
  ```
187
 
 
21
  — *end example*]
22
 
23
  ``` cpp
24
  namespace std {
25
  template<class Codecvt, class Elem = wchar_t,
26
+ class WideAlloc = allocator<Elem>,
27
+ class ByteAlloc = allocator<char>>
28
  class wstring_convert {
29
  public:
30
+ using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
31
+ using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
32
  using state_type = typename Codecvt::state_type;
33
  using int_type = typename wide_string::traits_type::int_type;
34
 
35
+ wstring_convert() : wstring_convert(new Codecvt) {}
36
+ explicit wstring_convert(Codecvt* pcvt);
37
  wstring_convert(Codecvt* pcvt, state_type state);
38
  explicit wstring_convert(const byte_string& byte_err,
39
  const wide_string& wide_err = wide_string());
40
  ~wstring_convert();
41
 
 
65
  }
66
  ```
67
 
68
  The class template describes an object that controls conversions between
69
  wide string objects of class `basic_string<Elem, char_traits<Elem>,
70
+ WideAlloc>` and byte string objects of class `basic_string<char,
71
+ char_traits<char>, ByteAlloc>`. The class template defines the types
72
  `wide_string` and `byte_string` as synonyms for these two types.
73
  Conversion between a sequence of `Elem` values (stored in a
74
  `wide_string` object) and multibyte sequences (stored in a `byte_string`
75
  object) is performed by an object of class `Codecvt`, which meets the
76
  requirements of the standard code-conversion facet `codecvt<Elem,
 
84
  freed when the `wstring_convert` object is destroyed)
85
  - `cvtstate` — a conversion state object
86
  - `cvtcount` — a conversion count
87
 
88
  ``` cpp
89
+ using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
90
  ```
91
 
92
  The type shall be a synonym for
93
+ `basic_string<char, char_traits<char>, ByteAlloc>`.
94
 
95
  ``` cpp
96
  size_t converted() const noexcept;
97
  ```
98
 
 
171
  constructed with a byte-error string, the member function shall return
172
  the byte-error string. Otherwise, the member function shall throw an
173
  object of class `range_error`.
174
 
175
  ``` cpp
176
+ using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
177
  ```
178
 
179
  The type shall be a synonym for
180
+ `basic_string<Elem, char_traits<Elem>, WideAlloc>`.
181
 
182
  ``` cpp
183
+ explicit wstring_convert(Codecvt* pcvt);
184
  wstring_convert(Codecvt* pcvt, state_type state);
185
  explicit wstring_convert(const byte_string& byte_err,
186
  const wide_string& wide_err = wide_string());
187
  ```
188