tmp/tmpv0ugyu33/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Element access <a id="string.view.access">[[string.view.access]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr const_reference operator[](size_type pos) const;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Requires:* `pos < size()`.
|
| 8 |
+
|
| 9 |
+
*Returns:* `data_[pos]`.
|
| 10 |
+
|
| 11 |
+
*Throws:* Nothing.
|
| 12 |
+
|
| 13 |
+
[*Note 1*: Unlike `basic_string::operator[]`,
|
| 14 |
+
`basic_string_view::operator[](size())` has undefined behavior instead
|
| 15 |
+
of returning `charT()`. — *end note*]
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
constexpr const_reference at(size_type pos) const;
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
*Throws:* `out_of_range` if `pos >= size()`.
|
| 22 |
+
|
| 23 |
+
*Returns:* `data_[pos]`.
|
| 24 |
+
|
| 25 |
+
``` cpp
|
| 26 |
+
constexpr const_reference front() const;
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
*Requires:* `!empty()`.
|
| 30 |
+
|
| 31 |
+
*Returns:* `data_[0]`.
|
| 32 |
+
|
| 33 |
+
*Throws:* Nothing.
|
| 34 |
+
|
| 35 |
+
``` cpp
|
| 36 |
+
constexpr const_reference back() const;
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
*Requires:* `!empty()`.
|
| 40 |
+
|
| 41 |
+
*Returns:* `data_[size() - 1]`.
|
| 42 |
+
|
| 43 |
+
*Throws:* Nothing.
|
| 44 |
+
|
| 45 |
+
``` cpp
|
| 46 |
+
constexpr const_pointer data() const noexcept;
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
*Returns:* `data_`.
|
| 50 |
+
|
| 51 |
+
[*Note 2*: Unlike `basic_string::data()` and string literals, `data()`
|
| 52 |
+
may return a pointer to a buffer that is not null-terminated. Therefore
|
| 53 |
+
it is typically a mistake to pass `data()` to a function that takes just
|
| 54 |
+
a `const charT*` and expects a null-terminated string. — *end note*]
|
| 55 |
+
|