Skip to content

Commit 8198fbe

Browse files
committed
Fix a comment, forgot a noexcept test
1 parent 706675f commit 8198fbe

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libcxx/test/std/utilities/optional/optional.iterator/begin.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ constexpr bool test() {
2828
assert(noexcept(nonconst_opt.begin()));
2929
}
3030

31-
{ // Dereferencing an iterator at the beggining as indexing the 0th element, and that those iterators are the same value returned by calling begin() again.
31+
{ // Dereferencing an iterator at the beginning == indexing the 0th element, and that calling begin() again return the same iterator.
3232
auto iter1 = opt.begin();
3333
auto iter2 = nonconst_opt.begin();
3434
assert(*iter1 == iter1[0]);

libcxx/test/std/utilities/optional/optional.iterator/end.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ constexpr bool test() {
2323
std::optional<T> unengaged{std::nullopt};
2424
constexpr std::optional<T> unengaged2{std::nullopt};
2525

26+
{ // end() is marked noexcept
27+
assert(noexcept(opt.end()));
28+
assert(noexcept(nonconst_opt.end()));
29+
}
30+
2631
{ // end() == begin() and end() == end() if the optional is unengaged
2732
auto it = unengaged.end();
2833
auto it2 = unengaged2.end();

0 commit comments

Comments
 (0)