Skip to content

Commit 55ee565

Browse files
committed
directly inherit from std::iterator_traits
1 parent 115cdd4 commit 55ee565

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

thrust/iterator/iterator_traits.h

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -38,59 +38,11 @@
3838
namespace thrust
3939
{
4040

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

9547
template<typename Iterator> struct iterator_value;
9648

0 commit comments

Comments
 (0)