1 | //===----------------------------------------------------------------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
10 | |
11 | #include "test_macros.h" |
12 | |
13 | TEST_DIAGNOSTIC_PUSH |
14 | TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header" ) |
15 | #include <__iterator/iterator_with_data.h> |
16 | TEST_DIAGNOSTIC_POP |
17 | |
18 | #include "test_iterators.h" |
19 | |
20 | static_assert(std::forward_iterator<std::__iterator_with_data<forward_iterator<int*>, int>>); |
21 | static_assert(std::bidirectional_iterator<std::__iterator_with_data<bidirectional_iterator<int*>, int>>); |
22 | static_assert(std::bidirectional_iterator<std::__iterator_with_data<random_access_iterator<int*>, int>>); |
23 | static_assert(std::bidirectional_iterator<std::__iterator_with_data<contiguous_iterator<int*>, int>>); |
24 | |
25 | constexpr bool test() { |
26 | { |
27 | std::__iterator_with_data<forward_iterator<int*>, int> iter(forward_iterator<int*>(nullptr), 3); |
28 | assert(iter == iter); |
29 | assert(iter.__get_iter() == forward_iterator<int*>(nullptr)); |
30 | assert(std::move(iter).__get_data() == 3); |
31 | } |
32 | |
33 | return true; |
34 | } |
35 | |
36 | int main(int, char**) { |
37 | test(); |
38 | static_assert(test()); |
39 | |
40 | return 0; |
41 | } |
42 | |