1 #ifndef OMEGA_H_CAST_ITERATOR_HPP
2 #define OMEGA_H_CAST_ITERATOR_HPP
8 template <
typename To,
typename From>
13 using value_type = To;
14 using difference_type = std::ptrdiff_t;
15 using reference = value_type;
16 using pointer = value_type
const*;
17 using iterator_category = std::random_access_iterator_tag;
19 OMEGA_H_INLINE
CastIterator(From
const* ptr_in) : ptr(ptr_in) {}
20 OMEGA_H_INLINE
bool operator==(
CastIterator const& other)
const {
21 return ptr == other.ptr;
23 OMEGA_H_INLINE
bool operator!=(
CastIterator const& other)
const {
24 return ptr != other.ptr;
26 OMEGA_H_INLINE reference operator*()
const {
return *ptr; }
32 auto const ret = *
this;
41 auto const ret = *
this;
45 OMEGA_H_INLINE
CastIterator& operator+=(difference_type n) {
49 OMEGA_H_INLINE
CastIterator& operator-=(difference_type n) {
53 OMEGA_H_INLINE
CastIterator operator+(difference_type n)
const {
56 OMEGA_H_INLINE
CastIterator operator-(difference_type n)
const {
59 OMEGA_H_INLINE difference_type operator-(
CastIterator const& other)
const {
60 return ptr - other.ptr;
62 OMEGA_H_INLINE value_type operator[](difference_type n)
const {
65 OMEGA_H_INLINE
bool operator<(
CastIterator const& other)
const {
66 return ptr < other.ptr;
68 OMEGA_H_INLINE
bool operator>(
CastIterator const& other)
const {
69 return ptr > other.ptr;
71 OMEGA_H_INLINE
bool operator<=(
CastIterator const& other)
const {
72 return ptr <= other.ptr;
74 OMEGA_H_INLINE
bool operator>=(
CastIterator const& other)
const {
75 return ptr >= other.ptr;
79 template <
typename To,
typename From>
81 typename CastIterator<To, From>::difference_type n,
Definition: Omega_h_cast_iterator.hpp:9
Definition: amr_mpi_test.cpp:6