|
1 | 1 | --- |
2 | | -title: "span Class (C++ Standard Library)| Microsoft Docs" |
| 2 | +title: "span class (C++ Standard Library)| Microsoft Docs" |
3 | 3 | ms.date: "05/28/2020" |
4 | 4 | f1_keywords: ["span/std::span", "span/std::span::const_pointer", "span/std::span::const_reference", "span/std::span::difference_type", "span/std::span::element_type", "span/std::span::iterator", "span/std::span::pointer", "span/std::span::reference", "span/std::span::reverse_iterator", "span/std::span::size_type", "span/std::span::value_type", "span/std::span::at", "span/std::span::assign", "span/std::span::back", "span/std::span::begin", "span/std::span::data", "span/std::span::empty", "span/std::span::end", "span/std::span::front", "span/std::span::rbegin", "span/std::span::rend", |
5 | 5 | "span/std::span::size", "span/std::span::size_bytes", "span/std::span::operator=", "span/std::span::operator[]"] |
6 | 6 | helpviewer_keywords: ["std::span [C++]", "std::span [C++], const_pointer", "std::span [C++], const_reference", "std::span [C++], difference_type", "std::span [C++], element_type", "std::span [C++], iterator", "std::span [C++], pointer", "std::span [C++], reference", "std::span [C++], reverse_iterator", "std::span [C++], size_type", "std::span [C++], value_type", "std::span [C++], assign", "std::span [C++], at", "std::span [C++], back", "std::span [C++], begin", "std::span [C++], data", "std::span [C++], empty", "std::span [C++], end", "std::span [C++], front", "std::span [C++], rbegin", "std::span [C++], rend", "std::span [C++], size", "std::span [C++], size_bytes"] |
7 | 7 | --- |
8 | | -# span Class (C++ Standard Library) |
| 8 | +# span class (C++ Standard Library) |
9 | 9 |
|
10 | 10 | Provides a lightweight view over a contiguous sequence of objects. A span provides a safe way to iterate over, and index into, objects that are arranged back-to-back in memory such as objects stored in a built-in array, `std::array`, or `std::vector`. |
11 | 11 |
|
@@ -89,7 +89,7 @@ Get the last element in the span. |
89 | 89 | constexpr reference back() const noexcept; |
90 | 90 | ``` |
91 | 91 |
|
92 | | -### Return Value |
| 92 | +### Return value |
93 | 93 |
|
94 | 94 | A reference to the last element in the span. |
95 | 95 |
|
@@ -156,7 +156,7 @@ Get a pointer to the beginning of the span data. |
156 | 156 | constexpr pointer data() const noexcept; |
157 | 157 | ``` |
158 | 158 |
|
159 | | -### Return Value |
| 159 | +### Return value |
160 | 160 |
|
161 | 161 | A pointer to the first item stored in the span. |
162 | 162 |
|
@@ -251,7 +251,7 @@ Whether the span contains elements. |
251 | 251 | constexpr bool empty() const noexcept; |
252 | 252 | ``` |
253 | 253 |
|
254 | | -### Return Value |
| 254 | +### Return value |
255 | 255 |
|
256 | 256 | Returns `true` if `this->size() == 0`. Otherwise `false`. |
257 | 257 |
|
@@ -279,7 +279,7 @@ Get an iterator to the end of the span. |
279 | 279 | constexpr iterator end() const noexcept; |
280 | 280 | ``` |
281 | 281 |
|
282 | | -### Return Value |
| 282 | +### Return value |
283 | 283 |
|
284 | 284 | An iterator pointing just beyond the end of the span. |
285 | 285 |
|
@@ -314,7 +314,7 @@ template <size_t count> constexpr auto first() const noexcept; |
314 | 314 | The number of elements from the front of this span to put in the subspan. |
315 | 315 | The number of elements is specified as a parameter to the template, or to the function, as illustrated below. |
316 | 316 |
|
317 | | -### Return Value |
| 317 | +### Return value |
318 | 318 |
|
319 | 319 | A span that contains `count` elements from the front of this span. |
320 | 320 |
|
@@ -364,7 +364,7 @@ Get the first element in the span. |
364 | 364 | constexpr reference front() const noexcept; |
365 | 365 | ``` |
366 | 366 |
|
367 | | -### Return Value |
| 367 | +### Return value |
368 | 368 |
|
369 | 369 | A reference to the first element in the span. |
370 | 370 |
|
@@ -494,7 +494,7 @@ constexpr reference operator[](size_type offset) const; |
494 | 494 | *offset*\ |
495 | 495 | Zero-based element in the span to access. |
496 | 496 |
|
497 | | -### Return Value |
| 497 | +### Return value |
498 | 498 |
|
499 | 499 | A reference to the element at position *offset*. If the position is invalid, the behavior is undefined. |
500 | 500 |
|
@@ -531,7 +531,7 @@ constexpr span& operator=(const span& other) noexcept = default; |
531 | 531 | *other*\ |
532 | 532 | The span to assign to this one. |
533 | 533 |
|
534 | | -### Return Value |
| 534 | +### Return value |
535 | 535 |
|
536 | 536 | `*this` |
537 | 537 |
|
@@ -610,7 +610,7 @@ Get a reverse iterator pointing to the last element of this span. |
610 | 610 | constexpr reverse_iterator rbegin() const noexcept; |
611 | 611 | ``` |
612 | 612 |
|
613 | | -### Return Value |
| 613 | +### Return value |
614 | 614 |
|
615 | 615 | An iterator pointing to the beginning of the reversed span. |
616 | 616 |
|
@@ -683,7 +683,7 @@ Get a random-access iterator that points just beyond the end of the reversed spa |
683 | 683 | constexpr reverse_iterator rend() const noexcept; |
684 | 684 | ``` |
685 | 685 |
|
686 | | -### Return Value |
| 686 | +### Return value |
687 | 687 |
|
688 | 688 | A reverse iterator to the placeholder following the last element in the reversed span; that is, the placeholder before the first element in the unreversed span. |
689 | 689 |
|
@@ -781,7 +781,7 @@ Get the size of the elements in the span in bytes. |
781 | 781 | constexpr size_type size_bytes() const noexcept; |
782 | 782 | ``` |
783 | 783 |
|
784 | | -### Return Value |
| 784 | +### Return value |
785 | 785 |
|
786 | 786 | The number of bytes that all of the elements in the span occupy; that is, `sizeof(element_type)` multiplied by the number of elements in the span. |
787 | 787 |
|
@@ -958,7 +958,7 @@ The number of elements to put in the subspan. If `count` is `dynamic_extent` (th |
958 | 958 | *offset*\ |
959 | 959 | The location in this span to start the subspan. |
960 | 960 |
|
961 | | -### Return Value |
| 961 | +### Return value |
962 | 962 |
|
963 | 963 | A span starting at `offset` in this span. Contains `count` elements. |
964 | 964 |
|
|
0 commit comments