Skip to content

Commit 441055f

Browse files
Update span.md
* Monospace `vector` and `array`, being the names of Standard containers. * `void main()` is non-Standard; it should be `int main()`. (There's a special rule that `return 0;` is unnecessary here.) * Qualify `std::cout`, otherwise the example won't compile. (There are still no spaces or newlines being printed after each element.) * Mention `/std:c++latest` as a requirement.
1 parent a5f1229 commit 441055f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/standard-library/span.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ helpviewer_keywords: ["span header"]
77

88
# <span>
99

10-
A `span` is a view over a contiguous sequence of objects. It provides fast and bounds-safe access. Unlike vector or array, it doesn't "own" the elements it provides access to.
10+
A `span` is a view over a contiguous sequence of objects. It provides fast and bounds-safe access. Unlike `vector` or `array`, it doesn't "own" the elements it provides access to.
1111

1212
See [span class](span-class.md) for detailed information. Here's an example of how a span can be used:
1313

@@ -20,17 +20,17 @@ void Show(std::span<int> someValues)
2020
// show values in reverse
2121
for (auto rIt = someValues.rbegin(); rIt != someValues.rend(); ++rIt)
2222
{
23-
cout << *rIt;
23+
std::cout << *rIt;
2424
}
2525

2626
// show a subspan
2727
for (auto& i : someValues.subspan(1, 2))
2828
{
29-
cout << i;
29+
std::cout << i;
3030
}
3131
}
3232

33-
void main()
33+
int main()
3434
{
3535
int numbers[]{ 0,1,2,3,4 };
3636
Show(numbers); // note conversion from array to span
@@ -43,6 +43,8 @@ void main()
4343
4444
**Namespace:** std
4545
46+
**Compiler Option:** /std:c++latest
47+
4648
## Members
4749
4850
### Classes
@@ -73,4 +75,4 @@ void main()
7375
7476
## See also
7577
76-
[Header Files Reference](../standard-library/cpp-standard-library-header-files.md)
78+
[Header Files Reference](../standard-library/cpp-standard-library-header-files.md)

0 commit comments

Comments
 (0)