From Jason Turner

[ostringstream]

Diff to HTML by rtfpessoa

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