From Jason Turner

[stringstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphevjwfg8/{from.md → to.md} +62 -23
tmp/tmphevjwfg8/{from.md → to.md} RENAMED
@@ -2,18 +2,17 @@
2
 
3
  #### General <a id="stringstream.general">[[stringstream.general]]</a>
4
 
5
  ``` cpp
6
  namespace std {
7
- template<class charT, class traits = char_traits<charT>,
8
- class Allocator = allocator<charT>>
9
  class basic_stringstream : public basic_iostream<charT, traits> {
10
  public:
11
  using char_type = charT;
12
- using int_type = typename traits::int_type;
13
- using pos_type = typename traits::pos_type;
14
- using off_type = typename traits::off_type;
15
  using traits_type = traits;
16
  using allocator_type = Allocator;
17
 
18
  // [stringstream.cons], constructors
19
  basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}
@@ -35,10 +34,17 @@ namespace std {
35
  ios_base::openmode which, const Allocator& a);
36
  template<class SAlloc>
37
  explicit basic_stringstream(
38
  const basic_string<charT, traits, SAlloc>& s,
39
  ios_base::openmode which = ios_base::out | ios_base::in);
 
 
 
 
 
 
 
40
  basic_stringstream(const basic_stringstream&) = delete;
41
  basic_stringstream(basic_stringstream&& rhs);
42
 
43
  basic_stringstream& operator=(const basic_stringstream&) = delete;
44
  basic_stringstream& operator=(basic_stringstream&& rhs);
@@ -57,13 +63,15 @@ namespace std {
57
 
58
  void str(const basic_string<charT, traits, Allocator>& s);
59
  template<class SAlloc>
60
  void str(const basic_string<charT, traits, SAlloc>& s);
61
  void str(basic_string<charT, traits, Allocator>&& s);
 
 
62
 
63
  private:
64
- basic_stringbuf<charT, traits> sb; // exposition only
65
  };
66
  }
67
  ```
68
 
69
  The class template `basic_stringstream<charT, traits>` supports reading
@@ -71,50 +79,50 @@ and writing from objects of class
71
  `basic_string<charT, traits, Allocator>`. It uses a
72
  `basic_stringbuf<charT, traits, Allocator>` object to control the
73
  associated sequence. For the sake of exposition, the maintained data is
74
  presented here as
75
 
76
- - `sb`, the `stringbuf` object.
77
 
78
  #### Constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
79
 
80
  ``` cpp
81
  explicit basic_stringstream(ios_base::openmode which);
82
  ```
83
 
84
  *Effects:* Initializes the base class with
85
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
86
- `sb` with `basic_stringbuf<charT, traits, Allocator>(which)`.
87
 
88
  ``` cpp
89
  explicit basic_stringstream(
90
  const basic_string<charT, traits, Allocator>& s,
91
  ios_base::openmode which = ios_base::out | ios_base::in);
92
  ```
93
 
94
  *Effects:* Initializes the base class with
95
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
96
- `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which)`.
97
 
98
  ``` cpp
99
  basic_stringstream(ios_base::openmode which, const Allocator& a);
100
  ```
101
 
102
  *Effects:* Initializes the base class with
103
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
104
- `sb` with `basic_stringbuf<charT, traits, Allocator>(which, a)`
105
  [[stringbuf.cons]].
106
 
107
  ``` cpp
108
  explicit basic_stringstream(
109
  basic_string<charT, traits, Allocator>&& s,
110
  ios_base::openmode which = ios_base::out | ios_base::in);
111
  ```
112
 
113
  *Effects:* Initializes the base class with
114
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
115
- `sb` with
116
  `basic_stringbuf<charT, traits, Allocator>(std::move(s), which)`
117
  [[stringbuf.cons]].
118
 
119
  ``` cpp
120
  template<class SAlloc>
@@ -122,12 +130,12 @@ template<class SAlloc>
122
  const basic_string<charT, traits, SAlloc>& s,
123
  ios_base::openmode which, const Allocator& a);
124
  ```
125
 
126
  *Effects:* Initializes the base class with
127
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
128
- `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which, a)`
129
  [[stringbuf.cons]].
130
 
131
  ``` cpp
132
  template<class SAlloc>
133
  explicit basic_stringstream(
@@ -136,23 +144,43 @@ template<class SAlloc>
136
  ```
137
 
138
  *Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
139
 
140
  *Effects:* Initializes the base class with
141
- `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
142
- `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which)`
143
  [[stringbuf.cons]].
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  ``` cpp
146
  basic_stringstream(basic_stringstream&& rhs);
147
  ```
148
 
149
  *Effects:* Move constructs from the rvalue `rhs`. This is accomplished
150
  by move constructing the base class, and the contained
151
  `basic_stringbuf`. Then calls
152
- `basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to install the
153
- contained `basic_stringbuf`.
154
 
155
  #### Swap <a id="stringstream.swap">[[stringstream.swap]]</a>
156
 
157
  ``` cpp
158
  void swap(basic_stringstream& rhs);
@@ -169,20 +197,20 @@ sb.swap(rhs.sb);
169
  template<class charT, class traits, class Allocator>
170
  void swap(basic_stringstream<charT, traits, Allocator>& x,
171
  basic_stringstream<charT, traits, Allocator>& y);
172
  ```
173
 
174
- *Effects:* Equivalent to: `x.swap(y)`.
175
 
176
  #### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
177
 
178
  ``` cpp
179
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
180
  ```
181
 
182
  *Returns:*
183
- `const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
184
 
185
  ``` cpp
186
  basic_string<charT, traits, Allocator> str() const &;
187
  ```
188
 
@@ -224,5 +252,16 @@ template<class SAlloc>
224
  void str(basic_string<charT, traits, Allocator>&& s);
225
  ```
226
 
227
  *Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
228
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  #### General <a id="stringstream.general">[[stringstream.general]]</a>
4
 
5
  ``` cpp
6
  namespace std {
7
+ template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
 
8
  class basic_stringstream : public basic_iostream<charT, traits> {
9
  public:
10
  using char_type = charT;
11
+ using int_type = traits::int_type;
12
+ using pos_type = traits::pos_type;
13
+ using off_type = traits::off_type;
14
  using traits_type = traits;
15
  using allocator_type = Allocator;
16
 
17
  // [stringstream.cons], constructors
18
  basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}
 
34
  ios_base::openmode which, const Allocator& a);
35
  template<class SAlloc>
36
  explicit basic_stringstream(
37
  const basic_string<charT, traits, SAlloc>& s,
38
  ios_base::openmode which = ios_base::out | ios_base::in);
39
+ template<class T>
40
+ explicit basic_stringstream(const T& t,
41
+ ios_base::openmode which = ios_base::out | ios_base::in);
42
+ template<class T>
43
+ basic_stringstream(const T& t, const Allocator& a);
44
+ template<class T>
45
+ basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a);
46
  basic_stringstream(const basic_stringstream&) = delete;
47
  basic_stringstream(basic_stringstream&& rhs);
48
 
49
  basic_stringstream& operator=(const basic_stringstream&) = delete;
50
  basic_stringstream& operator=(basic_stringstream&& rhs);
 
63
 
64
  void str(const basic_string<charT, traits, Allocator>& s);
65
  template<class SAlloc>
66
  void str(const basic_string<charT, traits, SAlloc>& s);
67
  void str(basic_string<charT, traits, Allocator>&& s);
68
+ template<class T>
69
+ void str(const T& t);
70
 
71
  private:
72
+ basic_stringbuf<charT, traits, Allocator> sb; // exposition only
73
  };
74
  }
75
  ```
76
 
77
  The class template `basic_stringstream<charT, traits>` supports reading
 
79
  `basic_string<charT, traits, Allocator>`. It uses a
80
  `basic_stringbuf<charT, traits, Allocator>` object to control the
81
  associated sequence. For the sake of exposition, the maintained data is
82
  presented here as
83
 
84
+ - *`sb`*, the `stringbuf` object.
85
 
86
  #### Constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
87
 
88
  ``` cpp
89
  explicit basic_stringstream(ios_base::openmode which);
90
  ```
91
 
92
  *Effects:* Initializes the base class with
93
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
94
+ and *sb* with `basic_stringbuf<charT, traits, Allocator>(which)`.
95
 
96
  ``` cpp
97
  explicit basic_stringstream(
98
  const basic_string<charT, traits, Allocator>& s,
99
  ios_base::openmode which = ios_base::out | ios_base::in);
100
  ```
101
 
102
  *Effects:* Initializes the base class with
103
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
104
+ and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which)`.
105
 
106
  ``` cpp
107
  basic_stringstream(ios_base::openmode which, const Allocator& a);
108
  ```
109
 
110
  *Effects:* Initializes the base class with
111
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
112
+ and *sb* with `basic_stringbuf<charT, traits, Allocator>(which, a)`
113
  [[stringbuf.cons]].
114
 
115
  ``` cpp
116
  explicit basic_stringstream(
117
  basic_string<charT, traits, Allocator>&& s,
118
  ios_base::openmode which = ios_base::out | ios_base::in);
119
  ```
120
 
121
  *Effects:* Initializes the base class with
122
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
123
+ and *sb* with
124
  `basic_stringbuf<charT, traits, Allocator>(std::move(s), which)`
125
  [[stringbuf.cons]].
126
 
127
  ``` cpp
128
  template<class SAlloc>
 
130
  const basic_string<charT, traits, SAlloc>& s,
131
  ios_base::openmode which, const Allocator& a);
132
  ```
133
 
134
  *Effects:* Initializes the base class with
135
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
136
+ and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which, a)`
137
  [[stringbuf.cons]].
138
 
139
  ``` cpp
140
  template<class SAlloc>
141
  explicit basic_stringstream(
 
144
  ```
145
 
146
  *Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
147
 
148
  *Effects:* Initializes the base class with
149
+ `basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
150
+ and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which)`
151
  [[stringbuf.cons]].
152
 
153
+ ``` cpp
154
+ template<class T>
155
+ explicit basic_stringstream(const T& t, ios_base::openmode which = ios_base::out | ios_base::in);
156
+ template<class T>
157
+ basic_stringstream(const T& t, const Allocator& a);
158
+ template<class T>
159
+ basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a);
160
+ ```
161
+
162
+ Let `which` be `ios_base::out | ios_base::in` for the overload with no
163
+ parameter `which`, and `a` be `Allocator()` for the overload with no
164
+ parameter `a`.
165
+
166
+ *Constraints:*
167
+ `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
168
+ `true`.
169
+
170
+ *Effects:* Initializes the base class with `addressof(`*`sb`*`)`, and
171
+ direct-non-list-initializes *sb* with `t, which, a`.
172
+
173
  ``` cpp
174
  basic_stringstream(basic_stringstream&& rhs);
175
  ```
176
 
177
  *Effects:* Move constructs from the rvalue `rhs`. This is accomplished
178
  by move constructing the base class, and the contained
179
  `basic_stringbuf`. Then calls
180
+ `basic_istream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
181
+ install the contained `basic_stringbuf`.
182
 
183
  #### Swap <a id="stringstream.swap">[[stringstream.swap]]</a>
184
 
185
  ``` cpp
186
  void swap(basic_stringstream& rhs);
 
197
  template<class charT, class traits, class Allocator>
198
  void swap(basic_stringstream<charT, traits, Allocator>& x,
199
  basic_stringstream<charT, traits, Allocator>& y);
200
  ```
201
 
202
+ *Effects:* Equivalent to `x.swap(y)`.
203
 
204
  #### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
205
 
206
  ``` cpp
207
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
208
  ```
209
 
210
  *Returns:*
211
+ `const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(`*`sb`*`))`.
212
 
213
  ``` cpp
214
  basic_string<charT, traits, Allocator> str() const &;
215
  ```
216
 
 
252
  void str(basic_string<charT, traits, Allocator>&& s);
253
  ```
254
 
255
  *Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
256
 
257
+ ``` cpp
258
+ template<class T>
259
+ void str(const T& t);
260
+ ```
261
+
262
+ *Constraints:*
263
+ `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
264
+ `true`.
265
+
266
+ *Effects:* Equivalent to: `rdbuf()->str(t);`
267
+