Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1491 from divyegala/update-iterator-traits
Browse files Browse the repository at this point in the history
thrust::iterator_traits to inherit from std::iterator_traits
  • Loading branch information
alliepiper authored Jul 21, 2021
2 parents 55af861 + 55ee565 commit ce483aa
Showing 1 changed file with 1 addition and 49 deletions.
50 changes: 1 addition & 49 deletions thrust/iterator/iterator_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,59 +37,11 @@

THRUST_NAMESPACE_BEGIN

namespace detail
{

template <typename T, typename = void>
struct iterator_traits_impl {};

template <typename T>
struct iterator_traits_impl<
T
, typename voider<
typename T::difference_type
, typename T::value_type
, typename T::pointer
, typename T::reference
, typename T::iterator_category
>::type
>
{
typedef typename T::difference_type difference_type;
typedef typename T::value_type value_type;
typedef typename T::pointer pointer;
typedef typename T::reference reference;
typedef typename T::iterator_category iterator_category;
};

} // namespace detail

/*! \p iterator_traits is a type trait class that provides a uniform
* interface for querying the properties of iterators at compile-time.
*/
template <typename T>
struct iterator_traits : detail::iterator_traits_impl<T> {};

// traits are specialized for pointer types
template<typename T>
struct iterator_traits<T*>
{
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef std::random_access_iterator_tag iterator_category;
};

template<typename T>
struct iterator_traits<const T*>
{
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef const T* pointer;
typedef const T& reference;
typedef std::random_access_iterator_tag iterator_category;
}; // end iterator_traits
struct iterator_traits : std::iterator_traits<T> {};

template<typename Iterator> struct iterator_value;

Expand Down

0 comments on commit ce483aa

Please sign in to comment.