- tmp/tmpz3cq73pc/{from.md → to.md} +126 -31
tmp/tmpz3cq73pc/{from.md → to.md}
RENAMED
|
@@ -1,40 +1,135 @@
|
|
| 1 |
#### Member functions <a id="stringbuf.members">[[stringbuf.members]]</a>
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
`
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
`
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
`basic_string
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 27 |
```
|
| 28 |
|
| 29 |
-
*Effects:*
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
`
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
|
|
|
| 1 |
#### Member functions <a id="stringbuf.members">[[stringbuf.members]]</a>
|
| 2 |
|
| 3 |
+
The member functions getting the underlying character sequence all refer
|
| 4 |
+
to a `high_mark` value, where `high_mark` represents the position one
|
| 5 |
+
past the highest initialized character in the buffer. Characters can be
|
| 6 |
+
initialized by writing to the stream, by constructing the
|
| 7 |
+
`basic_stringbuf` passing a `basic_string` argument, or by calling one
|
| 8 |
+
of the `str` member functions passing a `basic_string` as an argument.
|
| 9 |
+
In the latter case, all characters initialized prior to the call are now
|
| 10 |
+
considered uninitialized (except for those characters re-initialized by
|
| 11 |
+
the new `basic_string`).
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
void init_buf_ptrs(); // exposition only
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
*Effects:* Initializes the input and output sequences from `buf`
|
| 18 |
+
according to `mode`.
|
| 19 |
+
|
| 20 |
+
*Ensures:*
|
| 21 |
+
|
| 22 |
+
- If `ios_base::out` is set in `mode`, `pbase()` points to `buf.front()`
|
| 23 |
+
and `epptr() >= pbase() + buf.size()` is `true`;
|
| 24 |
+
- in addition, if `ios_base::ate` is set in `mode`,
|
| 25 |
+
`pptr() == pbase() + buf.size()` is `true`,
|
| 26 |
+
- otherwise `pptr() == pbase()` is `true`.
|
| 27 |
+
- If `ios_base::in` is set in `mode`, `eback()` points to `buf.front()`,
|
| 28 |
+
and `(gptr() == eback() && egptr() == eback() + buf.size())` is
|
| 29 |
+
`true`.
|
| 30 |
+
|
| 31 |
+
[*Note 1*: For efficiency reasons, stream buffer operations might
|
| 32 |
+
violate invariants of `buf` while it is held encapsulated in the
|
| 33 |
+
`basic_stringbuf`, e.g., by writing to characters in the range
|
| 34 |
+
\[`buf.data() + buf.size()`, `buf.data() + buf.capacity()`). All
|
| 35 |
+
operations retrieving a `basic_string` from `buf` ensure that the
|
| 36 |
+
`basic_string` invariants hold on the returned value. — *end note*]
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
allocator_type get_allocator() const noexcept;
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
*Returns:* `buf.get_allocator()`.
|
| 43 |
+
|
| 44 |
+
``` cpp
|
| 45 |
+
basic_string<charT, traits, Allocator> str() const &;
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
*Effects:* Equivalent to:
|
| 49 |
+
|
| 50 |
+
``` cpp
|
| 51 |
+
return basic_string<charT, traits, Allocator>(view(), get_allocator());
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
``` cpp
|
| 55 |
+
template<class SAlloc>
|
| 56 |
+
basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
*Constraints:* `SAlloc` is a type that qualifies as an
|
| 60 |
+
allocator [[container.requirements.general]].
|
| 61 |
+
|
| 62 |
+
*Effects:* Equivalent to:
|
| 63 |
+
|
| 64 |
+
``` cpp
|
| 65 |
+
return basic_string<charT, traits, SAlloc>(view(), sa);
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
``` cpp
|
| 69 |
+
basic_string<charT, traits, Allocator> str() &&;
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
*Returns:* A `basic_string<charT, traits, Allocator>` object move
|
| 73 |
+
constructed from the `basic_stringbuf`’s underlying character sequence
|
| 74 |
+
in `buf`. This can be achieved by first adjusting `buf` to have the same
|
| 75 |
+
content as `view()`.
|
| 76 |
+
|
| 77 |
+
*Ensures:* The underlying character sequence `buf` is empty and
|
| 78 |
+
`pbase()`, `pptr()`, `epptr()`, `eback()`, `gptr()`, and `egptr()` are
|
| 79 |
+
initialized as if by calling `init_buf_ptrs()` with an empty `buf`.
|
| 80 |
+
|
| 81 |
+
``` cpp
|
| 82 |
+
basic_string_view<charT, traits> view() const noexcept;
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Let `sv` be `basic_string_view<charT, traits>`.
|
| 86 |
+
|
| 87 |
+
*Returns:* A `sv` object referring to the `basic_stringbuf`’s underlying
|
| 88 |
+
character sequence in `buf`:
|
| 89 |
+
|
| 90 |
+
- If `ios_base::out` is set in `mode`, then
|
| 91 |
+
`sv(pbase(), high_mark-pbase())` is returned.
|
| 92 |
+
- Otherwise, if `ios_base::in` is set in `mode`, then
|
| 93 |
+
`sv(eback(), egptr()-eback())` is returned.
|
| 94 |
+
- Otherwise, `sv()` is returned.
|
| 95 |
+
|
| 96 |
+
[*Note 2*: Using the returned `sv` object after destruction or
|
| 97 |
+
invalidation of the character sequence underlying `*this` is undefined
|
| 98 |
+
behavior, unless `sv.empty()` is `true`. — *end note*]
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 102 |
```
|
| 103 |
|
| 104 |
+
*Effects:* Equivalent to:
|
| 105 |
+
|
| 106 |
+
``` cpp
|
| 107 |
+
buf = s;
|
| 108 |
+
init_buf_ptrs();
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
``` cpp
|
| 112 |
+
template<class SAlloc>
|
| 113 |
+
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
*Constraints:* `is_same_v<SAlloc,Allocator>` is `false`.
|
| 117 |
+
|
| 118 |
+
*Effects:* Equivalent to:
|
| 119 |
+
|
| 120 |
+
``` cpp
|
| 121 |
+
buf = s;
|
| 122 |
+
init_buf_ptrs();
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
``` cpp
|
| 126 |
+
void str(basic_string<charT, traits, Allocator>&& s);
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
*Effects:* Equivalent to:
|
| 130 |
+
|
| 131 |
+
``` cpp
|
| 132 |
+
buf = std::move(s);
|
| 133 |
+
init_buf_ptrs();
|
| 134 |
+
```
|
| 135 |
|