|
20 | 20 |
|
21 | 21 | template <typename T>
|
22 | 22 | constexpr bool test() {
|
23 |
| - std::optional<T> unengaged{std::nullopt}; |
24 |
| - const std::optional<T> unengaged2{std::nullopt}; |
| 23 | + std::optional<T> disengaged{std::nullopt}; |
| 24 | + const std::optional<T> disengaged2{std::nullopt}; |
25 | 25 |
|
26 | 26 | { // end() is marked noexcept
|
27 |
| - static_assert(noexcept(unengaged.end())); |
28 |
| - static_assert(noexcept(unengaged2.end())); |
| 27 | + static_assert(noexcept(disengaged.end())); |
| 28 | + static_assert(noexcept(disengaged2.end())); |
29 | 29 | }
|
30 | 30 |
|
31 |
| - { // end() == begin() and end() == end() if the optional is unengaged |
32 |
| - auto it = unengaged.end(); |
33 |
| - auto it2 = unengaged2.end(); |
| 31 | + { // end() == begin() and end() == end() if the optional is disengaged |
| 32 | + auto it = disengaged.end(); |
| 33 | + auto it2 = disengaged2.end(); |
34 | 34 |
|
35 |
| - assert(it == unengaged.begin()); |
36 |
| - assert(unengaged.begin() == it); |
37 |
| - assert(it == unengaged.end()); |
| 35 | + assert(it == disengaged.begin()); |
| 36 | + assert(disengaged.begin() == it); |
| 37 | + assert(it == disengaged.end()); |
38 | 38 |
|
39 |
| - assert(it2 == unengaged2.begin()); |
40 |
| - assert(unengaged2.begin() == it2); |
41 |
| - assert(it2 == unengaged2.end()); |
| 39 | + assert(it2 == disengaged2.begin()); |
| 40 | + assert(disengaged2.begin() == it2); |
| 41 | + assert(it2 == disengaged2.end()); |
42 | 42 | }
|
43 | 43 |
|
44 | 44 | std::optional<T> engaged{T{}};
|
|
0 commit comments