stdgpu/ranges.h Source File — stdgpu Latest documentation (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef STDGPU_RANGES_H
17#define STDGPU_RANGES_H
18
28#include <thrust/iterator/transform_iterator.h>
29
33
34namespace stdgpu
35{
36
42template
44{
45public:
47 using value_type = typename iterator::value_type;
49 using reference = typename iterator::reference;
55
61
69
77
85
92
99
106
113
114private:
117};
118
124template
126{
127public:
129 using value_type = typename iterator::value_type;
131 using reference = typename iterator::reference;
137
143
151
159
167
174
181
188
195
196private:
199};
200
207template <typename R, typename UnaryFunction>
209{
210public:
211 using iterator = thrust::transform_iterator<UnaryFunction,
212 typename R::iterator>;
214 using value_type = typename iterator::value_type;
216 using reference = typename iterator::reference;
222
229
237
244
251
258
265
266private:
269};
270
271namespace detail
272{
273
274template
275class select;
276
277}
278
284template
286
292template
294
295}
296
297#include <stdgpu/impl/ranges_detail.h>
298
299#endif
typename iterator::difference_type difference_type
Definition: ranges.h:48
device_ptr< T > iterator
Definition: ranges.h:46
typename iterator::value_type value_type
Definition: ranges.h:47
device_range(T *p)
Constructor with automatic size inference from the given pointer.
STDGPU_HOST_DEVICE device_range(T *p, index64_t n)
Constructor.
STDGPU_HOST_DEVICE iterator begin() const noexcept
An iterator to the begin of the range.
STDGPU_HOST_DEVICE iterator end() const noexcept
An iterator to the end of the range.
STDGPU_HOST_DEVICE index64_t size() const
The size.
STDGPU_HOST_DEVICE bool empty() const
Checks if the range is empty.
STDGPU_HOST_DEVICE device_range(iterator begin, iterator end)
Constructor.
STDGPU_HOST_DEVICE device_range(iterator begin, index64_t n)
Constructor.
typename iterator::reference reference
Definition: ranges.h:49
A class representing a device range over an array.
Definition: ranges.h:44
device_range()=default
Empty constructor.
STDGPU_HOST_DEVICE host_range(iterator begin, iterator end)
Constructor.
host_range(T *p)
Constructor with automatic size inference from the given pointer.
STDGPU_HOST_DEVICE host_range(iterator begin, index64_t n)
Constructor.
STDGPU_HOST_DEVICE iterator end() const noexcept
An iterator to the end of the range.
host_ptr< T > iterator
Definition: ranges.h:128
typename iterator::reference reference
Definition: ranges.h:131
STDGPU_HOST_DEVICE iterator begin() const noexcept
An iterator to the begin of the range.
STDGPU_HOST_DEVICE host_range(T *p, index64_t n)
Constructor.
typename iterator::difference_type difference_type
Definition: ranges.h:130
typename iterator::value_type value_type
Definition: ranges.h:129
STDGPU_HOST_DEVICE bool empty() const
Checks if the range is empty.
STDGPU_HOST_DEVICE index64_t size() const
The size.
A class representing a host range over an array.
Definition: ranges.h:126
host_range()=default
Empty constructor.
thrust::transform_iterator< UnaryFunction, typename R::iterator > iterator
Definition: ranges.h:213
STDGPU_HOST_DEVICE transform_range(R r, UnaryFunction f)
Constructor.
typename iterator::difference_type difference_type
Definition: ranges.h:215
STDGPU_HOST_DEVICE index64_t size() const
The size.
typename iterator::value_type value_type
Definition: ranges.h:214
typename iterator::reference reference
Definition: ranges.h:216
STDGPU_HOST_DEVICE transform_range(R r)
Constructor.
STDGPU_HOST_DEVICE iterator end() const noexcept
An iterator to the end of the range.
STDGPU_HOST_DEVICE iterator begin() const noexcept
An iterator to the begin of the range.
STDGPU_HOST_DEVICE bool empty() const
Checks if the range is empty.
A class representing range where a transformation is applied first.
Definition: ranges.h:209
transform_range()=default
Empty constructor.
std::ptrdiff_t index64_t
std::ptrdiff_t
Definition: cstddef.h:48
thrust::pointer< T, thrust::device_system_tag > device_ptr
A host pointer class allowing to call thrust algorithms without explicitly using the respective execu...
Definition: iterator.h:43
thrust::pointer< T, thrust::host_system_tag > host_ptr
A host pointer class allowing to call thrust algorithms without explicitly using the respective execu...
Definition: iterator.h:51
#define STDGPU_HOST_DEVICE
Platform-independent host device function annotation.
Definition: platform.h:77