// // Tests for // iterator begin() const; // iterator end() const; // #include #include "test_policy.h" #include #include struct T { int i; }; template static void tests() { using AR = test_bounded_array_ref; // Check begin()/end() for a non-null array ref { T array[5] = {T{0}, T{1}, T{2}, T{3}, T{4}}; AR const view(array); test_bounded_ptr begin = view.begin(); test_bounded_ptr end = view.end(); CHECK(begin.discard_bounds() == &array[0]); CHECK(end.unsafe_discard_bounds() == &array[5]); } // Check begin()/end() for a null array ref { AR const view; test_bounded_ptr begin = view.begin(); test_bounded_ptr end = view.end(); CHECK(begin.unsafe_discard_bounds() == nullptr); CHECK(end.unsafe_discard_bounds() == nullptr); } // Check associated types { static_assert(std::is_same_v >); } } T_DECL(begin_end, "bounded_array_ref.begin_end", T_META_TAG_VM_PREFERRED) { tests(); }