tmp/tmpu0fovmnm/{from.md → to.md}
RENAMED
|
@@ -9,39 +9,42 @@ 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
|
| 15 |
```
|
| 16 |
|
| 17 |
-
*Effects:* Initializes the input and output sequences from
|
| 18 |
-
according to
|
| 19 |
|
| 20 |
*Ensures:*
|
| 21 |
|
| 22 |
-
- If `ios_base::out` is set in
|
| 23 |
-
and `epptr() >= pbase() + buf.size()` is
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
- otherwise `pptr() == pbase()` is `true`.
|
| 27 |
-
- If `ios_base::in` is set in
|
| 28 |
-
|
|
|
|
| 29 |
`true`.
|
| 30 |
|
| 31 |
[*Note 1*: For efficiency reasons, stream buffer operations can violate
|
| 32 |
-
invariants of
|
| 33 |
`basic_stringbuf`, e.g., by writing to characters in the range
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
`basic_string`
|
|
|
|
| 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 |
|
|
@@ -55,11 +58,11 @@ return basic_string<charT, traits, Allocator>(view(), get_allocator());
|
|
| 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.
|
| 61 |
|
| 62 |
*Effects:* Equivalent to:
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
@@ -69,11 +72,11 @@ return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
| 69 |
basic_string<charT, traits, Allocator> str() &&;
|
| 70 |
```
|
| 71 |
|
| 72 |
*Ensures:* The underlying character sequence `buf` is empty and
|
| 73 |
`pbase()`, `pptr()`, `epptr()`, `eback()`, `gptr()`, and `egptr()` are
|
| 74 |
-
initialized as if by calling `
|
| 75 |
|
| 76 |
*Returns:* A `basic_string<charT, traits, Allocator>` object move
|
| 77 |
constructed from the `basic_stringbuf`’s underlying character sequence
|
| 78 |
in `buf`. This can be achieved by first adjusting `buf` to have the same
|
| 79 |
content as `view()`.
|
|
@@ -85,13 +88,13 @@ basic_string_view<charT, traits> view() const noexcept;
|
|
| 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
|
| 91 |
`sv(pbase(), high_mark - pbase())` is returned.
|
| 92 |
-
- Otherwise, if `ios_base::in` is set in
|
| 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
|
|
@@ -103,11 +106,11 @@ void str(const basic_string<charT, traits, Allocator>& s);
|
|
| 103 |
|
| 104 |
*Effects:* Equivalent to:
|
| 105 |
|
| 106 |
``` cpp
|
| 107 |
buf = s;
|
| 108 |
-
|
| 109 |
```
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
template<class SAlloc>
|
| 113 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
|
@@ -117,19 +120,36 @@ template<class SAlloc>
|
|
| 117 |
|
| 118 |
*Effects:* Equivalent to:
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
buf = s;
|
| 122 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
```
|
| 135 |
|
|
|
|
| 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();
|
| 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
|
| 23 |
+
*`buf`*`.front()` and `epptr() >= pbase() + `*`buf`*`.size()` is
|
| 24 |
+
`true`;
|
| 25 |
+
- in addition, if `ios_base::ate` is set in *mode*,
|
| 26 |
+
`pptr() == pbase() + `*`buf`*`.size()` is `true`,
|
| 27 |
- otherwise `pptr() == pbase()` is `true`.
|
| 28 |
+
- If `ios_base::in` is set in *mode*, `eback()` points to
|
| 29 |
+
*`buf`*`.front()`, and
|
| 30 |
+
`(gptr() == eback() && egptr() == eback() + `*`buf`*`.size())` is
|
| 31 |
`true`.
|
| 32 |
|
| 33 |
[*Note 1*: For efficiency reasons, stream buffer operations can violate
|
| 34 |
+
invariants of *buf* while it is held encapsulated in the
|
| 35 |
`basic_stringbuf`, e.g., by writing to characters in the range
|
| 36 |
+
[*`buf`*`.data() + `*`buf`*`.size()`,
|
| 37 |
+
*`buf`*`.data() + `*`buf`*`.capacity()`). All operations retrieving a
|
| 38 |
+
`basic_string` from `buf` ensure that the `basic_string` invariants hold
|
| 39 |
+
on the returned value. — *end note*]
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
allocator_type get_allocator() const noexcept;
|
| 43 |
```
|
| 44 |
|
| 45 |
+
*Returns:* *`buf`*`.get_allocator()`.
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
basic_string<charT, traits, Allocator> str() const &;
|
| 49 |
```
|
| 50 |
|
|
|
|
| 58 |
template<class SAlloc>
|
| 59 |
basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
|
| 60 |
```
|
| 61 |
|
| 62 |
*Constraints:* `SAlloc` is a type that qualifies as an
|
| 63 |
+
allocator [[container.reqmts]].
|
| 64 |
|
| 65 |
*Effects:* Equivalent to:
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
|
|
| 72 |
basic_string<charT, traits, Allocator> str() &&;
|
| 73 |
```
|
| 74 |
|
| 75 |
*Ensures:* The underlying character sequence `buf` is empty and
|
| 76 |
`pbase()`, `pptr()`, `epptr()`, `eback()`, `gptr()`, and `egptr()` are
|
| 77 |
+
initialized as if by calling *`init-buf-ptrs`*`()` with an empty `buf`.
|
| 78 |
|
| 79 |
*Returns:* A `basic_string<charT, traits, Allocator>` object move
|
| 80 |
constructed from the `basic_stringbuf`’s underlying character sequence
|
| 81 |
in `buf`. This can be achieved by first adjusting `buf` to have the same
|
| 82 |
content as `view()`.
|
|
|
|
| 88 |
Let `sv` be `basic_string_view<charT, traits>`.
|
| 89 |
|
| 90 |
*Returns:* A `sv` object referring to the `basic_stringbuf`’s underlying
|
| 91 |
character sequence in `buf`:
|
| 92 |
|
| 93 |
+
- If `ios_base::out` is set in *mode*, then
|
| 94 |
`sv(pbase(), high_mark - pbase())` is returned.
|
| 95 |
+
- Otherwise, if `ios_base::in` is set in *mode*, then
|
| 96 |
`sv(eback(), egptr() - eback())` is returned.
|
| 97 |
- Otherwise, `sv()` is returned.
|
| 98 |
|
| 99 |
[*Note 2*: Using the returned `sv` object after destruction or
|
| 100 |
invalidation of the character sequence underlying `*this` is undefined
|
|
|
|
| 106 |
|
| 107 |
*Effects:* Equivalent to:
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
buf = s;
|
| 111 |
+
init-buf-ptrs();
|
| 112 |
```
|
| 113 |
|
| 114 |
``` cpp
|
| 115 |
template<class SAlloc>
|
| 116 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
|
|
|
| 120 |
|
| 121 |
*Effects:* Equivalent to:
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
buf = s;
|
| 125 |
+
init-buf-ptrs();
|
| 126 |
```
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 130 |
```
|
| 131 |
|
| 132 |
*Effects:* Equivalent to:
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
buf = std::move(s);
|
| 136 |
+
init-buf-ptrs();
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
``` cpp
|
| 140 |
+
template<class T>
|
| 141 |
+
void str(const T& t);
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
*Constraints:*
|
| 145 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 146 |
+
`true`.
|
| 147 |
+
|
| 148 |
+
*Effects:* Equivalent to:
|
| 149 |
+
|
| 150 |
+
``` cpp
|
| 151 |
+
basic_string_view<charT, traits> sv = t;
|
| 152 |
+
buf = sv;
|
| 153 |
+
init-buf-ptrs();
|
| 154 |
```
|
| 155 |
|