2 * Copyright 2008-2013 NVIDIA Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 /*! \file iterator_traits.inl
19 * \brief Inline file for iterator_traits.h.
22 #include <thrust/iterator/iterator_categories.h>
23 #include <thrust/iterator/detail/iterator_category_to_traversal.h>
24 #include <thrust/detail/type_traits.h>
29 template<typename Iterator>
32 typedef typename thrust::iterator_traits<Iterator>::value_type type;
33 }; // end iterator_value
36 template<typename Iterator>
37 struct iterator_pointer
39 typedef typename thrust::iterator_traits<Iterator>::pointer type;
40 }; // end iterator_pointer
43 template<typename Iterator>
44 struct iterator_reference
46 typedef typename iterator_traits<Iterator>::reference type;
47 }; // end iterator_reference
50 template<typename Iterator>
51 struct iterator_difference
53 typedef typename thrust::iterator_traits<Iterator>::difference_type type;
54 }; // end iterator_difference
57 template<typename Iterator>
58 struct iterator_system
59 : detail::iterator_category_to_system<
60 typename thrust::iterator_traits<Iterator>::iterator_category
63 }; // end iterator_system
65 // specialize iterator_system for void *, which has no category
67 struct iterator_system<void *>
69 typedef thrust::iterator_system<int*>::type type;
70 }; // end iterator_system<void*>
73 struct iterator_system<const void *>
75 typedef thrust::iterator_system<const int*>::type type;
76 }; // end iterator_system<void*>
79 template <typename Iterator>
80 struct iterator_traversal
81 : detail::iterator_category_to_traversal<
82 typename thrust::iterator_traits<Iterator>::iterator_category
85 }; // end iterator_traversal
91 struct is_iterator_traversal
92 : thrust::detail::is_convertible<T, incrementable_traversal_tag>
94 }; // end is_iterator_traversal
98 struct is_iterator_system
100 detail::is_convertible<T, any_system_tag>,
102 detail::is_convertible<T, host_system_tag>,
103 detail::is_convertible<T, device_system_tag>
107 }; // end is_iterator_system
110 } // end namespace detail
111 } // end namespace thrust