Skip to content

Commit 538c850

Browse files
authored
[clang][docs] Fix typos in SafeBuffers.rst (llvm#163547)
1 parent 5d1e1cf commit 538c850

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/docs/SafeBuffers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ You can achieve this by refactoring the function to accept a ``std::span``
262262
as a parameter::
263263

264264
int get_last_element(std::span<int> sp) {
265-
return sp[size - 1];
265+
return sp[sp.size() - 1];
266266
}
267267

268268
This solution puts the responsibility for making sure the span is well-formed
@@ -411,7 +411,7 @@ backwards compatibility -- in terms of both API and ABI -- by adding
411411
a "compatibility overload"::
412412

413413
int get_last_element(std::span<int> sp) {
414-
return sp[size - 1];
414+
return sp[sp.size() - 1];
415415
}
416416

417417
[[clang::unsafe_buffer_usage]] // Please use the new function.

0 commit comments

Comments
 (0)