19
19
20
20
#include < unittest/unittest.h>
21
21
22
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<std::string::iterator>::value));
23
-
24
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<std::wstring::iterator>::value));
25
-
26
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<std::string_view::iterator>::value));
27
-
28
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<std::wstring_view::iterator>::value));
29
-
30
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<std::vector<bool >::iterator>::value));
22
+ static_assert (thrust::is_contiguous_iterator<std::string::iterator>::value);
23
+ static_assert (thrust::is_contiguous_iterator<std::wstring::iterator>::value);
24
+ static_assert (thrust::is_contiguous_iterator<std::string_view::iterator>::value);
25
+ static_assert (thrust::is_contiguous_iterator<std::wstring_view::iterator>::value);
26
+ static_assert (!thrust::is_contiguous_iterator<std::vector<bool >::iterator>::value);
31
27
32
28
template <typename T>
33
29
_CCCL_HOST void test_is_contiguous_iterator ()
34
30
{
35
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<T*>::value));
36
-
37
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<T const *>::value));
38
-
39
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<thrust::device_ptr<T>>::value));
40
-
41
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<typename std::vector<T>::iterator>::value));
42
-
43
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::vector<T>::reverse_iterator>::value));
44
-
45
- THRUST_STATIC_ASSERT ((thrust::is_contiguous_iterator<typename std::array<T, 1 >::iterator>::value));
46
-
47
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::list<T>::iterator>::value));
48
-
49
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::deque<T>::iterator>::value));
50
-
51
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::set<T>::iterator>::value));
52
-
53
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::multiset<T>::iterator>::value));
54
-
55
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::map<T, T>::iterator>::value));
56
-
57
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::multimap<T, T>::iterator>::value));
58
-
59
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::unordered_set<T>::iterator>::value));
60
-
61
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::unordered_multiset<T>::iterator>::value));
62
-
63
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::unordered_map<T, T>::iterator>::value));
64
-
65
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<typename std::unordered_multimap<T, T>::iterator>::value));
66
-
67
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<std::istream_iterator<T>>::value));
68
-
69
- THRUST_STATIC_ASSERT ((!thrust::is_contiguous_iterator<std::ostream_iterator<T>>::value));
31
+ static_assert (thrust::is_contiguous_iterator<T*>::value);
32
+ static_assert (thrust::is_contiguous_iterator<T const *>::value);
33
+ static_assert (thrust::is_contiguous_iterator<thrust::device_ptr<T>>::value);
34
+ static_assert (thrust::is_contiguous_iterator<typename std::vector<T>::iterator>::value);
35
+ static_assert (!thrust::is_contiguous_iterator<typename std::vector<T>::reverse_iterator>::value);
36
+ static_assert (thrust::is_contiguous_iterator<typename std::array<T, 1 >::iterator>::value);
37
+ static_assert (!thrust::is_contiguous_iterator<typename std::list<T>::iterator>::value);
38
+ static_assert (!thrust::is_contiguous_iterator<typename std::deque<T>::iterator>::value);
39
+ static_assert (!thrust::is_contiguous_iterator<typename std::set<T>::iterator>::value);
40
+ static_assert (!thrust::is_contiguous_iterator<typename std::multiset<T>::iterator>::value);
41
+ static_assert (!thrust::is_contiguous_iterator<typename std::map<T, T>::iterator>::value);
42
+ static_assert (!thrust::is_contiguous_iterator<typename std::multimap<T, T>::iterator>::value);
43
+ static_assert (!thrust::is_contiguous_iterator<typename std::unordered_set<T>::iterator>::value);
44
+ static_assert (!thrust::is_contiguous_iterator<typename std::unordered_multiset<T>::iterator>::value);
45
+ static_assert (!thrust::is_contiguous_iterator<typename std::unordered_map<T, T>::iterator>::value);
46
+ static_assert (!thrust::is_contiguous_iterator<typename std::unordered_multimap<T, T>::iterator>::value);
47
+ static_assert (!thrust::is_contiguous_iterator<std::istream_iterator<T>>::value);
48
+ static_assert (!thrust::is_contiguous_iterator<std::ostream_iterator<T>>::value);
70
49
}
71
50
DECLARE_GENERIC_UNITTEST (test_is_contiguous_iterator);
72
51
73
52
template <typename Vector>
74
53
_CCCL_HOST void test_is_contiguous_iterator_vectors ()
75
54
{
76
- THRUST_STATIC_ASSERT (( thrust::is_contiguous_iterator<typename Vector::iterator>::value) );
55
+ static_assert ( thrust::is_contiguous_iterator<typename Vector::iterator>::value);
77
56
}
78
57
DECLARE_VECTOR_UNITTEST (test_is_contiguous_iterator_vectors);
79
58
@@ -98,38 +77,34 @@ template <typename T>
98
77
void test_try_unwrap_contiguous_iterator ()
99
78
{
100
79
// Raw pointers should pass whether expecting pointers or passthrough.
101
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<T*, T*, expect_pointer>::value));
102
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<T*, T*, expect_passthrough>::value));
103
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<T const *, T const *, expect_pointer>::value));
104
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<T const *, T const *, expect_passthrough>::value));
105
-
106
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<thrust::device_ptr<T>, T*, expect_pointer>::value));
107
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<thrust::device_ptr<T const >, T const *, expect_pointer>::value));
108
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::vector<T>::iterator, T*, expect_pointer>::value));
109
- THRUST_STATIC_ASSERT (
110
- (check_unwrapped_iterator<typename std::vector<T>::reverse_iterator, T*, expect_passthrough>::value));
111
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::array<T, 1 >::iterator, T*, expect_pointer>::value));
112
- THRUST_STATIC_ASSERT (
113
- (check_unwrapped_iterator<typename std::array<T const , 1 >::iterator, T const *, expect_pointer>::value));
114
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::list<T>::iterator, T*, expect_passthrough>::value));
115
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::deque<T>::iterator, T*, expect_passthrough>::value));
116
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::set<T>::iterator, T*, expect_passthrough>::value));
117
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::multiset<T>::iterator, T*, expect_passthrough>::value));
118
- THRUST_STATIC_ASSERT (
119
- (check_unwrapped_iterator<typename std::map<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::value));
120
- THRUST_STATIC_ASSERT ((
121
- check_unwrapped_iterator<typename std::multimap<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::value));
122
- THRUST_STATIC_ASSERT (
123
- (check_unwrapped_iterator<typename std::unordered_set<T>::iterator, T*, expect_passthrough>::value));
124
- THRUST_STATIC_ASSERT (
125
- (check_unwrapped_iterator<typename std::unordered_multiset<T>::iterator, T*, expect_passthrough>::value));
126
- THRUST_STATIC_ASSERT (
127
- (check_unwrapped_iterator<typename std::unordered_map<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::
128
- value));
129
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<typename std::unordered_multimap<T, T>::iterator,
130
- std::pair<T const , T>*,
131
- expect_passthrough>::value));
132
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<std::istream_iterator<T>, T*, expect_passthrough>::value));
133
- THRUST_STATIC_ASSERT ((check_unwrapped_iterator<std::ostream_iterator<T>, void , expect_passthrough>::value));
80
+ static_assert (check_unwrapped_iterator<T*, T*, expect_pointer>::value);
81
+ static_assert (check_unwrapped_iterator<T*, T*, expect_passthrough>::value);
82
+ static_assert (check_unwrapped_iterator<T const *, T const *, expect_pointer>::value);
83
+ static_assert (check_unwrapped_iterator<T const *, T const *, expect_passthrough>::value);
84
+
85
+ static_assert (check_unwrapped_iterator<thrust::device_ptr<T>, T*, expect_pointer>::value);
86
+ static_assert (check_unwrapped_iterator<thrust::device_ptr<T const >, T const *, expect_pointer>::value);
87
+ static_assert (check_unwrapped_iterator<typename std::vector<T>::iterator, T*, expect_pointer>::value);
88
+ static_assert (check_unwrapped_iterator<typename std::vector<T>::reverse_iterator, T*, expect_passthrough>::value);
89
+ static_assert (check_unwrapped_iterator<typename std::array<T, 1 >::iterator, T*, expect_pointer>::value);
90
+ static_assert (check_unwrapped_iterator<typename std::array<T const , 1 >::iterator, T const *, expect_pointer>::value);
91
+ static_assert (check_unwrapped_iterator<typename std::list<T>::iterator, T*, expect_passthrough>::value);
92
+ static_assert (check_unwrapped_iterator<typename std::deque<T>::iterator, T*, expect_passthrough>::value);
93
+ static_assert (check_unwrapped_iterator<typename std::set<T>::iterator, T*, expect_passthrough>::value);
94
+ static_assert (check_unwrapped_iterator<typename std::multiset<T>::iterator, T*, expect_passthrough>::value);
95
+ static_assert (
96
+ check_unwrapped_iterator<typename std::map<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::value);
97
+ static_assert (
98
+ check_unwrapped_iterator<typename std::multimap<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::value);
99
+ static_assert (check_unwrapped_iterator<typename std::unordered_set<T>::iterator, T*, expect_passthrough>::value);
100
+ static_assert (check_unwrapped_iterator<typename std::unordered_multiset<T>::iterator, T*, expect_passthrough>::value);
101
+ static_assert (
102
+ check_unwrapped_iterator<typename std::unordered_map<T, T>::iterator, std::pair<T const , T>*, expect_passthrough>::
103
+ value);
104
+ static_assert (check_unwrapped_iterator<typename std::unordered_multimap<T, T>::iterator,
105
+ std::pair<T const , T>*,
106
+ expect_passthrough>::value);
107
+ static_assert (check_unwrapped_iterator<std::istream_iterator<T>, T*, expect_passthrough>::value);
108
+ static_assert (check_unwrapped_iterator<std::ostream_iterator<T>, void , expect_passthrough>::value);
134
109
}
135
110
DECLARE_GENERIC_UNITTEST (test_try_unwrap_contiguous_iterator);
0 commit comments