From Jason Turner

[stringstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4ob4v4il/{from.md → to.md} +133 -35
tmp/tmp4ob4v4il/{from.md → to.md} RENAMED
@@ -12,27 +12,52 @@ namespace std {
12
  using off_type = typename traits::off_type;
13
  using traits_type = traits;
14
  using allocator_type = Allocator;
15
 
16
  // [stringstream.cons], constructors
 
 
17
  explicit basic_stringstream(
 
18
  ios_base::openmode which = ios_base::out | ios_base::in);
 
19
  explicit basic_stringstream(
20
- const basic_string<charT, traits, Allocator>& str,
21
  ios_base::openmode which = ios_base::out | ios_base::in);
22
- basic_stringstream(const basic_stringstream& rhs) = delete;
 
 
 
 
 
 
 
 
 
 
 
 
23
  basic_stringstream(basic_stringstream&& rhs);
24
 
25
  // [stringstream.assign], assign and swap
26
- basic_stringstream& operator=(const basic_stringstream& rhs) = delete;
27
  basic_stringstream& operator=(basic_stringstream&& rhs);
28
  void swap(basic_stringstream& rhs);
29
 
30
  // [stringstream.members], members
31
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
32
- basic_string<charT, traits, Allocator> str() const;
33
- void str(const basic_string<charT, traits, Allocator>& str);
 
 
 
 
 
 
 
 
 
34
 
35
  private:
36
  basic_stringbuf<charT, traits> sb; // exposition only
37
  };
38
 
@@ -49,83 +74,156 @@ and writing from objects of class
49
  associated sequence. For the sake of exposition, the maintained data is
50
  presented here as
51
 
52
  - `sb`, the `stringbuf` object.
53
 
54
- #### `basic_stringstream` constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
 
 
 
 
 
 
 
 
55
 
56
  ``` cpp
57
  explicit basic_stringstream(
 
58
  ios_base::openmode which = ios_base::out | ios_base::in);
59
  ```
60
 
61
- *Effects:* Constructs an object of class
62
- `basic_stringstream<charT, traits>`, initializing the base class with
63
- `basic_iostream(&sb)` and initializing `sb` with
64
- `basic_stringbuf<charT, traits, Allocator>(which)`.
 
 
 
 
 
 
 
 
65
 
66
  ``` cpp
67
  explicit basic_stringstream(
68
- const basic_string<charT, traits, Allocator>& str,
69
  ios_base::openmode which = ios_base::out | ios_base::in);
70
  ```
71
 
72
- *Effects:* Constructs an object of class
73
- `basic_stringstream<charT, traits>`, initializing the base class with
74
- `basic_iostream(&sb)` and initializing `sb` with
75
- `basic_stringbuf<charT, traits, Allocator>(str, which)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  ``` cpp
78
  basic_stringstream(basic_stringstream&& rhs);
79
  ```
80
 
81
  *Effects:* Move constructs from the rvalue `rhs`. This is accomplished
82
  by move constructing the base class, and the contained
83
- `basic_stringbuf`. Next `basic_istream<charT, traits>::set_rdbuf(&sb)`
84
- is called to install the contained `basic_stringbuf`.
 
85
 
86
- #### Assign and swap <a id="stringstream.assign">[[stringstream.assign]]</a>
87
-
88
- ``` cpp
89
- basic_stringstream& operator=(basic_stringstream&& rhs);
90
- ```
91
-
92
- *Effects:* Move assigns the base and members of `*this` from the base
93
- and corresponding members of `rhs`.
94
-
95
- *Returns:* `*this`.
96
 
97
  ``` cpp
98
  void swap(basic_stringstream& rhs);
99
  ```
100
 
101
- *Effects:* Exchanges the state of `*this` and `rhs` by calling
102
- `basic_iostream<charT,traits>::swap(rhs)` and `sb.swap(rhs.sb)`.
 
 
 
 
103
 
104
  ``` cpp
105
  template<class charT, class traits, class Allocator>
106
  void swap(basic_stringstream<charT, traits, Allocator>& x,
107
  basic_stringstream<charT, traits, Allocator>& y);
108
  ```
109
 
110
- *Effects:* As if by `x.swap(y)`.
111
 
112
  #### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
113
 
114
  ``` cpp
115
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
116
  ```
117
 
118
- *Returns:* `const_cast<basic_stringbuf<charT, traits, Allocator>*>(&sb)`
 
119
 
120
  ``` cpp
121
- basic_string<charT, traits, Allocator> str() const;
122
  ```
123
 
124
- *Returns:* `rdbuf()->str()`.
125
 
126
  ``` cpp
127
- void str(const basic_string<charT, traits, Allocator>& str);
 
128
  ```
129
 
130
- *Effects:* Calls `rdbuf()->str(str)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
 
12
  using off_type = typename traits::off_type;
13
  using traits_type = traits;
14
  using allocator_type = Allocator;
15
 
16
  // [stringstream.cons], constructors
17
+ basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}
18
+ explicit basic_stringstream(ios_base::openmode which);
19
  explicit basic_stringstream(
20
+ const basic_string<charT, traits, Allocator>& s,
21
  ios_base::openmode which = ios_base::out | ios_base::in);
22
+ basic_stringstream(ios_base::openmode which, const Allocator& a);
23
  explicit basic_stringstream(
24
+ basic_string<charT, traits, Allocator>&& s,
25
  ios_base::openmode which = ios_base::out | ios_base::in);
26
+ template<class SAlloc>
27
+ basic_stringstream(
28
+ const basic_string<charT, traits, SAlloc>& s, const Allocator& a)
29
+ : basic_stringstream(s, ios_base::out | ios_base::in, a) {}
30
+ template<class SAlloc>
31
+ basic_stringstream(
32
+ const basic_string<charT, traits, SAlloc>& s,
33
+ ios_base::openmode which, const Allocator& a);
34
+ template<class SAlloc>
35
+ explicit basic_stringstream(
36
+ const basic_string<charT, traits, SAlloc>& s,
37
+ ios_base::openmode which = ios_base::out | ios_base::in);
38
+ basic_stringstream(const basic_stringstream&) = delete;
39
  basic_stringstream(basic_stringstream&& rhs);
40
 
41
  // [stringstream.assign], assign and swap
42
+ basic_stringstream& operator=(const basic_stringstream&) = delete;
43
  basic_stringstream& operator=(basic_stringstream&& rhs);
44
  void swap(basic_stringstream& rhs);
45
 
46
  // [stringstream.members], members
47
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
48
+
49
+ basic_string<charT, traits, Allocator> str() const &;
50
+ template<class SAlloc>
51
+ basic_string<charT,traits,SAlloc> str(const SAlloc& sa) const;
52
+ basic_string<charT, traits, Allocator> str() &&;
53
+ basic_string_view<charT, traits> view() const noexcept;
54
+
55
+ void str(const basic_string<charT, traits, Allocator>& s);
56
+ template<class SAlloc>
57
+ void str(const basic_string<charT, traits, SAlloc>& s);
58
+ void str(basic_string<charT, traits, Allocator>&& s);
59
 
60
  private:
61
  basic_stringbuf<charT, traits> sb; // exposition only
62
  };
63
 
 
74
  associated sequence. For the sake of exposition, the maintained data is
75
  presented here as
76
 
77
  - `sb`, the `stringbuf` object.
78
 
79
+ #### Constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
80
+
81
+ ``` cpp
82
+ explicit basic_stringstream(ios_base::openmode which);
83
+ ```
84
+
85
+ *Effects:* Initializes the base class with
86
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
87
+ `sb` with `basic_stringbuf<charT, traits, Allocator>(which)`.
88
 
89
  ``` cpp
90
  explicit basic_stringstream(
91
+ const basic_string<charT, traits, Allocator>& s,
92
  ios_base::openmode which = ios_base::out | ios_base::in);
93
  ```
94
 
95
+ *Effects:* Initializes the base class with
96
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
97
+ `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which)`.
98
+
99
+ ``` cpp
100
+ basic_stringstream(ios_base::openmode which, const Allocator& a);
101
+ ```
102
+
103
+ *Effects:* Initializes the base class with
104
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
105
+ `sb` with `basic_stringbuf<charT, traits, Allocator>(which, a)`
106
+ [[stringbuf.cons]].
107
 
108
  ``` cpp
109
  explicit basic_stringstream(
110
+ basic_string<charT, traits, Allocator>&& s,
111
  ios_base::openmode which = ios_base::out | ios_base::in);
112
  ```
113
 
114
+ *Effects:* Initializes the base class with
115
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
116
+ `sb` with
117
+ `basic_stringbuf<charT, traits, Allocator>(std::move(s), which)`
118
+ [[stringbuf.cons]].
119
+
120
+ ``` cpp
121
+ template<class SAlloc>
122
+ basic_stringstream(
123
+ const basic_string<charT, traits, SAlloc>& s,
124
+ ios_base::openmode which, const Allocator& a);
125
+ ```
126
+
127
+ *Effects:* Initializes the base class with
128
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
129
+ `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which, a)`
130
+ [[stringbuf.cons]].
131
+
132
+ ``` cpp
133
+ template<class SAlloc>
134
+ explicit basic_stringstream(
135
+ const basic_string<charT, traits, SAlloc>& s,
136
+ ios_base::openmode which = ios_base::out | ios_base::in);
137
+ ```
138
+
139
+ *Constraints:* `is_same_v<SAlloc,Allocator>` is `false`.
140
+
141
+ *Effects:* Initializes the base class with
142
+ `basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]] and
143
+ `sb` with `basic_stringbuf<charT, traits, Allocator>(s, which)`
144
+ [[stringbuf.cons]].
145
 
146
  ``` cpp
147
  basic_stringstream(basic_stringstream&& rhs);
148
  ```
149
 
150
  *Effects:* Move constructs from the rvalue `rhs`. This is accomplished
151
  by move constructing the base class, and the contained
152
+ `basic_stringbuf`. Then calls
153
+ `basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to install the
154
+ contained `basic_stringbuf`.
155
 
156
+ #### Assignment and swap <a id="stringstream.assign">[[stringstream.assign]]</a>
 
 
 
 
 
 
 
 
 
157
 
158
  ``` cpp
159
  void swap(basic_stringstream& rhs);
160
  ```
161
 
162
+ *Effects:* Equivalent to:
163
+
164
+ ``` cpp
165
+ basic_iostream<charT,traits>::swap(rhs);
166
+ sb.swap(rhs.sb);
167
+ ```
168
 
169
  ``` cpp
170
  template<class charT, class traits, class Allocator>
171
  void swap(basic_stringstream<charT, traits, Allocator>& x,
172
  basic_stringstream<charT, traits, Allocator>& y);
173
  ```
174
 
175
+ *Effects:* Equivalent to: `x.swap(y)`.
176
 
177
  #### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
178
 
179
  ``` cpp
180
  basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
181
  ```
182
 
183
+ *Returns:*
184
+ `const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
185
 
186
  ``` cpp
187
+ basic_string<charT, traits, Allocator> str() const &;
188
  ```
189
 
190
+ *Effects:* Equivalent to: `return rdbuf()->str();`
191
 
192
  ``` cpp
193
+ template<class SAlloc>
194
+ basic_string<charT,traits,SAlloc> str(const SAlloc& sa) const;
195
  ```
196
 
197
+ *Effects:* Equivalent to: `return rdbuf()->str(sa);`
198
+
199
+ ``` cpp
200
+ basic_string<charT,traits,Allocator> str() &&;
201
+ ```
202
+
203
+ *Effects:* Equivalent to: `return std::move(*rdbuf()).str();`
204
+
205
+ ``` cpp
206
+ basic_string_view<charT, traits> view() const noexcept;
207
+ ```
208
+
209
+ *Effects:* Equivalent to: `return rdbuf()->view();`
210
+
211
+ ``` cpp
212
+ void str(const basic_string<charT, traits, Allocator>& s);
213
+ ```
214
+
215
+ *Effects:* Equivalent to: `rdbuf()->str(s);`
216
+
217
+ ``` cpp
218
+ template<class SAlloc>
219
+ void str(const basic_string<charT, traits, SAlloc>& s);
220
+ ```
221
+
222
+ *Effects:* Equivalent to: `rdbuf()->str(s);`
223
+
224
+ ``` cpp
225
+ void str(basic_string<charT, traits, Allocator>&& s);
226
+ ```
227
+
228
+ *Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
229