//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // template // struct __bounded_iter; // // std::pointer_traits specialization #include <__cxx03/__iterator/bounded_iter.h> #include #include #include #include #include "test_iterators.h" #include "test_macros.h" template TEST_CONSTEXPR_CXX14 bool tests() { using BoundedIter = std::__bounded_iter; using PointerTraits = std::pointer_traits; using BasePointerTraits = std::pointer_traits; static_assert(std::is_same::value, ""); static_assert(std::is_same::value, ""); static_assert(std::is_same::value, ""); { int array[] = {0, 1, 2, 3, 4}; int* b = array + 0; int* e = array + 5; std::__bounded_iter const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); std::__bounded_iter const iter2 = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e)); assert(std::__to_address(iter1) == b); // in-bounds iterator assert(std::__to_address(iter2) == e); // out-of-bounds iterator } return true; } int main(int, char**) { tests(); return 0; }