File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
libcxx/test/std/utilities/optional/optional.iterator Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1414// template <class T> class optional::const_iterator;
1515
1616#include < cassert>
17- #include < iterator>
1817#include < optional>
1918#include < ranges>
2019#include < type_traits>
2120#include < utility>
2221
22+ template <typename T>
23+ constexpr bool test_range_concept () {
24+ return std::ranges::range<std::optional<T>>;
25+ }
26+
2327template <typename T, std::remove_reference_t <T> __val>
2428constexpr bool test () {
2529 std::remove_reference_t <T> v{__val};
2630 std::optional<T> opt{v};
31+ {
32+ assert (test_range_concept<T>());
33+ }
2734
2835 { // Dereferencing an iterator of an engaged optional will return the same value that the optional holds.
2936 auto it = opt.begin ();
@@ -94,6 +101,10 @@ constexpr bool tests() {
94101 assert ((test<const int &, 2 >()));
95102 assert ((test<const char &, ' b' >()));
96103
104+ assert (!test_range_concept<int (&)()>());
105+ assert (!test_range_concept<int (&)[]>());
106+ assert (!test_range_concept<int (&)[42 ]>());
107+
97108 return true ;
98109}
99110
You can’t perform that action at this time.
0 commit comments