40 #ifndef ECUDA_PTR_STRIDING_PADDED_PTR_HPP
41 #define ECUDA_PTR_STRIDING_PADDED_PTR_HPP
45 #include "../global.hpp"
46 #include "../type_traits.hpp"
47 #include "../utility.hpp"
77 template<typename T,typename P=typename ecuda::add_pointer<T>::type>
94 template<
typename U>
struct char_ptr;
95 template<
typename U>
struct char_ptr<U*> {
typedef char* type; };
96 template<
typename U>
struct char_ptr<const U*> {
typedef const char* type; };
105 template<
typename T2,
typename P2>
108 #ifdef ECUDA_CPP11_AVAILABLE
113 ptr = std::move(src.ptr);
114 stride = std::move(src.stride);
131 typedef typename char_ptr<pointer>::type char_pointer_type;
132 ptr =
reinterpret_cast<pointer>(
reinterpret_cast<char_pointer_type
>(ptr) + stride );
137 typedef typename char_ptr<pointer>::type char_pointer_type;
138 ptr =
reinterpret_cast<pointer>(
reinterpret_cast<char_pointer_type
>(ptr) - stride );
146 typedef typename char_ptr<pointer>::type char_pointer_type;
147 ptr =
reinterpret_cast<pointer>(
reinterpret_cast<char_pointer_type
>(ptr) + x*stride );
152 typedef typename char_ptr<pointer>::type char_pointer_type;
153 ptr =
reinterpret_cast<pointer>(
reinterpret_cast<char_pointer_type
>(ptr) - x*stride );
162 template<
typename T2,
typename P2>
__HOST__ __DEVICE__ inline bool operator< ( const striding_padded_ptr<T2,P2>& other )
const {
return ptr < other.ptr; }
164 template<
typename T2,
typename P2>
__HOST__ __DEVICE__ inline bool operator<=( const striding_padded_ptr<T2,P2>& other )
const {
return ptr <= other.ptr; }
167 template<
typename U,
typename V>
168 friend std::basic_ostream<U,V>& operator<<( std::basic_ostream<U,V>& out,
const striding_padded_ptr& ptr )
170 out <<
"striding_padded_ptr(ptr=" << ptr.ptr <<
";stride=" << ptr.stride <<
")";
__HOST__ __DEVICE__ striding_padded_ptr(const striding_padded_ptr &src)
__HOST__ __DEVICE__ size_type get_stride() const
__HOST__ __DEVICE__ striding_padded_ptr operator+(int x) const
__HOST__ __DEVICE__ striding_padded_ptr(pointer ptr=pointer(), size_type stride=0)
__HOST__ __DEVICE__ bool operator!=(const striding_padded_ptr< T2, P2 > &other) const
__HOST__ __DEVICE__ striding_padded_ptr operator++(int)
friend class striding_padded_ptr
__DEVICE__ const_reference operator[](std::size_t i) const
__HOST__ __DEVICE__ bool operator>=(const striding_padded_ptr< T2, P2 > &other) const
__DEVICE__ const_reference operator*() const
__HOST__ __DEVICE__ bool operator>(const striding_padded_ptr< T2, P2 > &other) const
__DEVICE__ reference operator[](std::size_t i)
A specialized pointer to striding memory.
__DEVICE__ reference operator*()
std::ptrdiff_t difference_type
__HOST__ __DEVICE__ striding_padded_ptr & operator--()
__DEVICE__ pointer operator->() const
__HOST__ __DEVICE__ striding_padded_ptr operator-(int x) const
const T & const_reference
__HOST__ __DEVICE__ striding_padded_ptr(const striding_padded_ptr< T2, P2 > &src)
__HOST__ __DEVICE__ striding_padded_ptr & operator-=(int x)
__HOST__ __DEVICE__ striding_padded_ptr & operator++()
__HOST__ __DEVICE__ striding_padded_ptr operator--(int)
__HOST__ __DEVICE__ bool operator==(const striding_padded_ptr< T2, P2 > &other) const
__HOST__ __DEVICE__ striding_padded_ptr & operator+=(int x)