1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
16 #include "test_iterators.h"
19 constexpr void check(int* first
, int* expected
) {
21 std::same_as
<It
> auto result
= std::ranges::prev(std::move(it
));
22 assert(base(result
) == expected
);
25 constexpr bool test() {
26 int range
[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
28 for (int n
= 1; n
!= 10; ++n
) {
29 check
<bidirectional_iterator
<int*>>(range
+n
, range
+n
-1);
30 check
<random_access_iterator
<int*>>(range
+n
, range
+n
-1);
31 check
<contiguous_iterator
<int*>>( range
+n
, range
+n
-1);
32 check
<int*>( range
+n
, range
+n
-1);
39 int main(int, char**) {
41 static_assert(test());