Skip to content

Commit ce483aa

Browse files
authored
Merge pull request NVIDIA#1491 from divyegala/update-iterator-traits
thrust::iterator_traits to inherit from std::iterator_traits
2 parents 55af861 + 55ee565 commit ce483aa

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

thrust/iterator/iterator_traits.h

+1-49
Original file line numberDiff line numberDiff line change
@@ -37,59 +37,11 @@
3737

3838
THRUST_NAMESPACE_BEGIN
3939

40-
namespace detail
41-
{
42-
43-
template <typename T, typename = void>
44-
struct iterator_traits_impl {};
45-
46-
template <typename T>
47-
struct iterator_traits_impl<
48-
T
49-
, typename voider<
50-
typename T::difference_type
51-
, typename T::value_type
52-
, typename T::pointer
53-
, typename T::reference
54-
, typename T::iterator_category
55-
>::type
56-
>
57-
{
58-
typedef typename T::difference_type difference_type;
59-
typedef typename T::value_type value_type;
60-
typedef typename T::pointer pointer;
61-
typedef typename T::reference reference;
62-
typedef typename T::iterator_category iterator_category;
63-
};
64-
65-
} // namespace detail
66-
6740
/*! \p iterator_traits is a type trait class that provides a uniform
6841
* interface for querying the properties of iterators at compile-time.
6942
*/
7043
template <typename T>
71-
struct iterator_traits : detail::iterator_traits_impl<T> {};
72-
73-
// traits are specialized for pointer types
74-
template<typename T>
75-
struct iterator_traits<T*>
76-
{
77-
typedef std::ptrdiff_t difference_type;
78-
typedef T value_type;
79-
typedef T* pointer;
80-
typedef T& reference;
81-
typedef std::random_access_iterator_tag iterator_category;
82-
};
83-
84-
template<typename T>
85-
struct iterator_traits<const T*>
86-
{
87-
typedef std::ptrdiff_t difference_type;
88-
typedef T value_type;
89-
typedef const T* pointer;
90-
typedef const T& reference;
91-
typedef std::random_access_iterator_tag iterator_category;
92-
}; // end iterator_traits
44+
struct iterator_traits : std::iterator_traits<T> {};
9345

9446
template<typename Iterator> struct iterator_value;
9547

0 commit comments

Comments
 (0)