tmp/tmpkzxsmvnh/{from.md → to.md}
RENAMED
|
@@ -6,13 +6,13 @@
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 8 |
class basic_syncbuf : public basic_streambuf<charT, traits> {
|
| 9 |
public:
|
| 10 |
using char_type = charT;
|
| 11 |
-
using int_type =
|
| 12 |
-
using pos_type =
|
| 13 |
-
using off_type =
|
| 14 |
using traits_type = traits;
|
| 15 |
using allocator_type = Allocator;
|
| 16 |
|
| 17 |
using streambuf_type = basic_streambuf<charT, traits>;
|
| 18 |
|
|
@@ -39,11 +39,11 @@ namespace std {
|
|
| 39 |
// [syncstream.syncbuf.virtuals], overridden virtual functions
|
| 40 |
int sync() override;
|
| 41 |
|
| 42 |
private:
|
| 43 |
streambuf_type* wrapped; // exposition only
|
| 44 |
-
bool
|
| 45 |
};
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
Class template `basic_syncbuf` stores character data written to it,
|
|
@@ -58,11 +58,11 @@ wrapped stream buffer object.
|
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
basic_syncbuf(streambuf_type* obuf, const Allocator& allocator);
|
| 61 |
```
|
| 62 |
|
| 63 |
-
*Effects:* Sets
|
| 64 |
|
| 65 |
*Ensures:* `get_wrapped() == obuf` and `get_allocator() == allocator`
|
| 66 |
are `true`.
|
| 67 |
|
| 68 |
*Throws:* Nothing unless an exception is thrown by the construction of a
|
|
@@ -133,13 +133,13 @@ void swap(basic_syncbuf& other);
|
|
| 133 |
``` cpp
|
| 134 |
bool emit();
|
| 135 |
```
|
| 136 |
|
| 137 |
*Effects:* Atomically transfers the associated output of `*this` to the
|
| 138 |
-
stream buffer `*wrapped`, so that it appears in the output stream as
|
| 139 |
-
contiguous sequence of characters. `wrapped->pubsync()` is called
|
| 140 |
-
only if a call was made to `sync()` since the most recent call to
|
| 141 |
`emit()`, if any.
|
| 142 |
|
| 143 |
*Synchronization:* All `emit()` calls transferring characters to the
|
| 144 |
same stream buffer object appear to execute in a total order consistent
|
| 145 |
with the “happens before” relation [[intro.races]], where each `emit()`
|
|
@@ -148,23 +148,23 @@ call synchronizes with subsequent `emit()` calls in that total order.
|
|
| 148 |
*Ensures:* On success, the associated output is empty.
|
| 149 |
|
| 150 |
*Returns:* `true` if all of the following conditions hold; otherwise
|
| 151 |
`false`:
|
| 152 |
|
| 153 |
-
- `wrapped == nullptr` is `false`.
|
| 154 |
- All of the characters in the associated output were successfully
|
| 155 |
transferred.
|
| 156 |
-
- The call to `wrapped->pubsync()` (if any) succeeded.
|
| 157 |
|
| 158 |
-
*Remarks:* May call member functions of
|
| 159 |
-
uniquely associated with
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
streambuf_type* get_wrapped() const noexcept;
|
| 163 |
```
|
| 164 |
|
| 165 |
-
*Returns:*
|
| 166 |
|
| 167 |
``` cpp
|
| 168 |
allocator_type get_allocator() const noexcept;
|
| 169 |
```
|
| 170 |
|
|
@@ -173,22 +173,22 @@ assignment operator.
|
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
void set_emit_on_sync(bool b) noexcept;
|
| 176 |
```
|
| 177 |
|
| 178 |
-
*Effects:* `
|
| 179 |
|
| 180 |
#### Overridden virtual functions <a id="syncstream.syncbuf.virtuals">[[syncstream.syncbuf.virtuals]]</a>
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
int sync() override;
|
| 184 |
```
|
| 185 |
|
| 186 |
*Effects:* Records that the wrapped stream buffer is to be flushed.
|
| 187 |
-
Then, if
|
| 188 |
|
| 189 |
-
[*Note 1*: If
|
| 190 |
until a call to `emit()`. — *end note*]
|
| 191 |
|
| 192 |
*Returns:* If `emit()` was called and returned `false`, returns `-1`;
|
| 193 |
otherwise `0`.
|
| 194 |
|
|
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 8 |
class basic_syncbuf : public basic_streambuf<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 |
using streambuf_type = basic_streambuf<charT, traits>;
|
| 18 |
|
|
|
|
| 39 |
// [syncstream.syncbuf.virtuals], overridden virtual functions
|
| 40 |
int sync() override;
|
| 41 |
|
| 42 |
private:
|
| 43 |
streambuf_type* wrapped; // exposition only
|
| 44 |
+
bool emit-on-sync{}; // exposition only
|
| 45 |
};
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
Class template `basic_syncbuf` stores character data written to it,
|
|
|
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
basic_syncbuf(streambuf_type* obuf, const Allocator& allocator);
|
| 61 |
```
|
| 62 |
|
| 63 |
+
*Effects:* Sets *wrapped* to `obuf`.
|
| 64 |
|
| 65 |
*Ensures:* `get_wrapped() == obuf` and `get_allocator() == allocator`
|
| 66 |
are `true`.
|
| 67 |
|
| 68 |
*Throws:* Nothing unless an exception is thrown by the construction of a
|
|
|
|
| 133 |
``` cpp
|
| 134 |
bool emit();
|
| 135 |
```
|
| 136 |
|
| 137 |
*Effects:* Atomically transfers the associated output of `*this` to the
|
| 138 |
+
stream buffer `*`*`wrapped`*, so that it appears in the output stream as
|
| 139 |
+
a contiguous sequence of characters. *`wrapped`*`->pubsync()` is called
|
| 140 |
+
if and only if a call was made to `sync()` since the most recent call to
|
| 141 |
`emit()`, if any.
|
| 142 |
|
| 143 |
*Synchronization:* All `emit()` calls transferring characters to the
|
| 144 |
same stream buffer object appear to execute in a total order consistent
|
| 145 |
with the “happens before” relation [[intro.races]], where each `emit()`
|
|
|
|
| 148 |
*Ensures:* On success, the associated output is empty.
|
| 149 |
|
| 150 |
*Returns:* `true` if all of the following conditions hold; otherwise
|
| 151 |
`false`:
|
| 152 |
|
| 153 |
+
- *`wrapped`*` == nullptr` is `false`.
|
| 154 |
- All of the characters in the associated output were successfully
|
| 155 |
transferred.
|
| 156 |
+
- The call to *`wrapped`*`->pubsync()` (if any) succeeded.
|
| 157 |
|
| 158 |
+
*Remarks:* May call member functions of *wrapped* while holding a lock
|
| 159 |
+
uniquely associated with *wrapped*.
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
streambuf_type* get_wrapped() const noexcept;
|
| 163 |
```
|
| 164 |
|
| 165 |
+
*Returns:* *wrapped*.
|
| 166 |
|
| 167 |
``` cpp
|
| 168 |
allocator_type get_allocator() const noexcept;
|
| 169 |
```
|
| 170 |
|
|
|
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
void set_emit_on_sync(bool b) noexcept;
|
| 176 |
```
|
| 177 |
|
| 178 |
+
*Effects:* *`emit-on-sync`*` = b`.
|
| 179 |
|
| 180 |
#### Overridden virtual functions <a id="syncstream.syncbuf.virtuals">[[syncstream.syncbuf.virtuals]]</a>
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
int sync() override;
|
| 184 |
```
|
| 185 |
|
| 186 |
*Effects:* Records that the wrapped stream buffer is to be flushed.
|
| 187 |
+
Then, if *emit-on-sync* is `true`, calls `emit()`.
|
| 188 |
|
| 189 |
+
[*Note 1*: If *emit-on-sync* is `false`, the actual flush is delayed
|
| 190 |
until a call to `emit()`. — *end note*]
|
| 191 |
|
| 192 |
*Returns:* If `emit()` was called and returned `false`, returns `-1`;
|
| 193 |
otherwise `0`.
|
| 194 |
|