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

Eliminate unused iterators #1189

Merged
merged 2 commits into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 0 additions & 333 deletions thrust/system/cuda/detail/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,6 @@ struct transform_input_iterator_t
return op(input[n]);
}

#if 0
/// Structure dereference
__host__ __device__ __forceinline__ pointer operator->()
{
return &op(*input_itr);
}
#endif

/// Equal to
__host__ __device__ __forceinline__ bool operator==(const self_t &rhs) const
{
Expand All @@ -346,14 +338,6 @@ struct transform_input_iterator_t
{
return (input != rhs.input);
}

#if 0
/// ostream operator
friend std::ostream& operator<<(std::ostream& os, const self& itr)
{
return os;
}
#endif
}; // struct transform_input_iterarot_t

template <class ValueType,
Expand Down Expand Up @@ -474,121 +458,6 @@ struct transform_pair_of_input_iterators_t

}; // struct transform_pair_of_input_iterators_t

template <class ValueType,
class InputIt1,
class InputIt2,
class InputIt3,
class TransformOp>
struct transform_triple_of_input_iterators_t
{
typedef transform_triple_of_input_iterators_t self_t;
typedef typename iterator_traits<InputIt1>::difference_type difference_type;
typedef ValueType value_type;
typedef value_type * pointer;
typedef value_type reference;
typedef std::random_access_iterator_tag iterator_category;

InputIt1 input1;
InputIt2 input2;
InputIt3 input3;
mutable TransformOp op;

__host__ __device__ __forceinline__
transform_triple_of_input_iterators_t(InputIt1 input1_,
InputIt2 input2_,
InputIt3 input3_,
TransformOp op_)
: input1(input1_), input2(input2_), input3(input3_), op(op_) {}

/// Postfix increment
__host__ __device__ __forceinline__ self_t operator++(int)
{
self_t retval = *this;
++input1;
++input2;
++input3;
return retval;
}

/// Prefix increment
__host__ __device__ __forceinline__ self_t operator++()
{
++input1;
++input2;
++input3;
return *this;
}

/// Indirection
__host__ __device__ __forceinline__ reference operator*() const
{
return op(*input1, *input2, *input3);
}
/// Indirection
__host__ __device__ __forceinline__ reference operator*()
{
return op(*input1, *input2, *input3);
}

/// Addition
__host__ __device__ __forceinline__ self_t operator+(difference_type n) const
{
return self_t(input1 + n, input2 + n, input3 + n, op);
}

/// Addition assignment
__host__ __device__ __forceinline__ self_t &operator+=(difference_type n)
{
input1 += n;
input2 += n;
input3 += n;
return *this;
}

/// Subtraction
__host__ __device__ __forceinline__ self_t operator-(difference_type n) const
{
return self_t(input1 - n, input2 - n, input3 - n, op);
}

/// Subtraction assignment
__host__ __device__ __forceinline__ self_t &operator-=(difference_type n)
{
input1 -= n;
input2 -= n;
input3 -= n;
return *this;
}

/// Distance
__host__ __device__ __forceinline__ difference_type operator-(self_t other) const
{
return input1 - other.input1;
}

/// Array subscript
__host__ __device__ __forceinline__ reference operator[](difference_type n) const
{
return op(input1[n], input2[n], input3[n]);
}

/// Equal to
__host__ __device__ __forceinline__ bool operator==(const self_t &rhs) const
{
return (input1 == rhs.input1) &&
(input2 == rhs.input2) &&
(input3 == rhs.input3);
}

/// Not equal to
__host__ __device__ __forceinline__ bool operator!=(const self_t &rhs) const
{
return (input1 != rhs.input1) ||
(input2 != rhs.input2) ||
(input3 != rhs.input3);
}

}; // struct transform_triple_of_input_iterators_t

struct identity
{
Expand All @@ -607,208 +476,6 @@ struct identity
}
};

template <class ValueType,
class OutputIt,
class TransformOp = identity>
struct transform_output_iterator_t
{
struct proxy_reference
{
private:
OutputIt output;
TransformOp op;

public:
__host__ __device__
proxy_reference(OutputIt const &output_, TransformOp op_)
: output(output_), op(op_) {}

proxy_reference __host__ __device__
operator=(ValueType const &x)
{
*output = op(x);
return *this;
}
};

typedef transform_output_iterator_t self_t;
typedef typename iterator_traits<OutputIt>::difference_type difference_type;
typedef void value_type;
typedef proxy_reference reference;
typedef std::output_iterator_tag iterator_category;

OutputIt output;
TransformOp op;

__host__ __device__ __forceinline__
transform_output_iterator_t(OutputIt output)
: output(output) {}

__host__ __device__ __forceinline__
transform_output_iterator_t(OutputIt output, TransformOp op)
: output(output), op(op) {}

/// Postfix increment
__host__ __device__ __forceinline__ self_t operator++(int)
{
self_t retval = *this;
++output;
return retval;
}

/// Prefix increment
__host__ __device__ __forceinline__ self_t operator++()
{
++output;
return *this;
}

/// Indirection
__host__ __device__ __forceinline__ reference operator*() const
{
return proxy_reference(output, op);
}
/// Indirection
__host__ __device__ __forceinline__ reference operator*()
{
return proxy_reference(output, op);
}

/// Addition
__host__ __device__ __forceinline__ self_t operator+(difference_type n) const
{
return self_t(output + n, op);
}

/// Addition assignment
__host__ __device__ __forceinline__ self_t &operator+=(difference_type n)
{
output += n;
return *this;
}

/// Subtraction
__host__ __device__ __forceinline__ self_t operator-(difference_type n) const
{
return self_t(output - n, op);
}

/// Subtraction assignment
__host__ __device__ __forceinline__ self_t &operator-=(difference_type n)
{
output -= n;
return *this;
}

/// Distance
__host__ __device__ __forceinline__ difference_type operator-(self_t other) const
{
return output - other.output;
}

/// Array subscript
__host__ __device__ __forceinline__ reference operator[](difference_type n) const
{
return *(output + n);
}

/// Equal to
__host__ __device__ __forceinline__ bool operator==(const self_t &rhs) const
{
return (output == rhs.output);
}

/// Not equal to
__host__ __device__ __forceinline__ bool operator!=(const self_t &rhs) const
{
return (output != rhs.output);
}
}; // struct transform_output_iterator_

template <class T, T VALUE>
struct static_integer_iterator
{
typedef static_integer_iterator self_t;
typedef int difference_type;
typedef T value_type;
typedef T reference;
typedef std::random_access_iterator_tag iterator_category;

__host__ __device__ __forceinline__
static_integer_iterator() {}

/// Postfix increment
__host__ __device__ __forceinline__ self_t operator++(int)
{
return *this;
}

/// Prefix increment
__host__ __device__ __forceinline__ self_t operator++()
{
return *this;
}

/// Indirection
__host__ __device__ __forceinline__ reference operator*() const
{
return VALUE;
}
/// Indirection
__host__ __device__ __forceinline__ reference operator*()
{
return VALUE;
}

/// Addition
__host__ __device__ __forceinline__ self_t operator+(difference_type ) const
{
return self_t();
}

/// Addition assignment
__host__ __device__ __forceinline__ self_t &operator+=(difference_type )
{
return *this;
}

/// Subtraction
__host__ __device__ __forceinline__ self_t operator-(difference_type ) const
{
return self_t();
}

/// Subtraction assignment
__host__ __device__ __forceinline__ self_t &operator-=(difference_type )
{
return *this;
}

/// Distance
__host__ __device__ __forceinline__ difference_type operator-(self_t ) const
{
return 0;
}

/// Array subscript
__host__ __device__ __forceinline__ reference operator[](difference_type ) const
{
return VALUE;
}

/// Equal to
__host__ __device__ __forceinline__ bool operator==(const self_t &) const
{
return true;
}

/// Not equal to
__host__ __device__ __forceinline__ bool operator!=(const self_t &) const
{
return false;
}

}; // struct static_bool_iterator

template <class T>
struct counting_iterator_t
Expand Down