|
1 | 1 | // SPDX-License-Identifier: BSD-3-Clause |
2 | | -/* Copyright 2020, Intel Corporation */ |
| 2 | +/* Copyright 2020-2021, Intel Corporation */ |
3 | 3 |
|
4 | 4 | /** |
5 | 5 | * @file |
@@ -67,8 +67,18 @@ class basic_string_view { |
67 | 67 | constexpr basic_string_view(const std::basic_string<CharT, Traits> &s); |
68 | 68 | constexpr basic_string_view(const CharT *data); |
69 | 69 |
|
| 70 | + /** Constructor initialized with the basic_string_view *rhs*. |
| 71 | + * |
| 72 | + * @param[in] rhs basic_string_view to initialize with |
| 73 | + */ |
70 | 74 | constexpr basic_string_view(const basic_string_view &rhs) noexcept = |
71 | 75 | default; |
| 76 | + |
| 77 | + /** |
| 78 | + * Replaces the view with that of *rhs*. |
| 79 | + * |
| 80 | + * @param[in] rhs basic_string_view to replace with |
| 81 | + */ |
72 | 82 | basic_string_view & |
73 | 83 | operator=(const basic_string_view &rhs) noexcept = default; |
74 | 84 |
|
@@ -165,7 +175,7 @@ constexpr inline basic_string_view<CharT, Traits>::basic_string_view() noexcept |
165 | 175 | } |
166 | 176 |
|
167 | 177 | /** |
168 | | - * Constructor initialized by *data* and its *size*. |
| 178 | + * Constructor initialized with *data* and its *size*. |
169 | 179 | * |
170 | 180 | * @param[in] data pointer to the C-like string to initialize with, |
171 | 181 | * it can contain null characters. |
@@ -256,27 +266,59 @@ basic_string_view<CharT, Traits>::cend() const noexcept |
256 | 266 | return data_ + size_; |
257 | 267 | } |
258 | 268 |
|
| 269 | +/** |
| 270 | + * Returns a reverse_iterator to the character following the last character of |
| 271 | + * the view (reverse beginning). Reverse iterators iterate backwards: increasing |
| 272 | + * them moves them towards the beginning of the string. |
| 273 | + * |
| 274 | + * @return const_reverse_iterator to the character following the last character. |
| 275 | + */ |
259 | 276 | template <typename CharT, typename Traits> |
260 | 277 | constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator |
261 | 278 | basic_string_view<CharT, Traits>::rbegin() const noexcept |
262 | 279 | { |
263 | 280 | return reverse_iterator(cend()); |
264 | 281 | } |
265 | 282 |
|
| 283 | +/** |
| 284 | + * Returns a reverse_iterator to the character following the last character of |
| 285 | + * the view (reverse beginning). Reverse iterators iterate backwards: increasing |
| 286 | + * them moves them towards the beginning of the string. |
| 287 | + * |
| 288 | + * @return const_reverse_iterator to the character following the last character. |
| 289 | + */ |
266 | 290 | template <typename CharT, typename Traits> |
267 | 291 | constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator |
268 | 292 | basic_string_view<CharT, Traits>::crbegin() const noexcept |
269 | 293 | { |
270 | 294 | return reverse_iterator(cend()); |
271 | 295 | } |
272 | 296 |
|
| 297 | +/** |
| 298 | + * Returns an iterator to the first character of the view. |
| 299 | + * Reverse iterators iterate backwards: increasing |
| 300 | + * them moves them towards the beginning of the string. |
| 301 | + * This character acts as a placeholder, attempting to access it results |
| 302 | + * in undefined behavior. |
| 303 | + * |
| 304 | + * @return const_reverse_iterator to the first character |
| 305 | + */ |
273 | 306 | template <typename CharT, typename Traits> |
274 | 307 | constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator |
275 | 308 | basic_string_view<CharT, Traits>::rend() const noexcept |
276 | 309 | { |
277 | 310 | return reverse_iterator(cbegin()); |
278 | 311 | } |
279 | 312 |
|
| 313 | +/** |
| 314 | + * Returns an iterator to the first character of the view. |
| 315 | + * Reverse iterators iterate backwards: increasing |
| 316 | + * them moves them towards the beginning of the string. |
| 317 | + * This character acts as a placeholder, attempting to access it results |
| 318 | + * in undefined behavior. |
| 319 | + * |
| 320 | + * @return const_reverse_iterator to the first character |
| 321 | + */ |
280 | 322 | template <typename CharT, typename Traits> |
281 | 323 | constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator |
282 | 324 | basic_string_view<CharT, Traits>::crend() const noexcept |
@@ -444,7 +486,7 @@ basic_string_view<CharT, Traits>::swap( |
444 | 486 | std::swap(size_, v.size_); |
445 | 487 | } |
446 | 488 |
|
447 | | -/* |
| 489 | +/** |
448 | 490 | * Finds the first substring equal to str. |
449 | 491 | * |
450 | 492 | * @param[in] str string to search for |
|
0 commit comments