14 class ContiguousConstIterator
17 using Allocator = std::allocator<Type>;
18 using AllocType =
typename std::allocator_traits<Allocator>::template rebind_alloc<Type>;
19 using AllocTraits = std::allocator_traits<AllocType>;
22 using iterator_category = std::random_access_iterator_tag;
23 using value_type = Type;
24 using pointer =
typename AllocTraits::pointer;
25 using reference =
const value_type &;
26 using difference_type =
typename AllocTraits::difference_type;
28 ContiguousConstIterator() =
default;
30 explicit ContiguousConstIterator(pointer ptr, intptr_t index) noexcept
34 assert((
"index must not be negative", index >= 0));
37 reference operator*() const noexcept
42 pointer operator->() const noexcept
47 ContiguousConstIterator<Type> &operator++() noexcept
53 ContiguousConstIterator<Type> operator++(
int)
noexcept
60 ContiguousConstIterator<Type> &operator--() noexcept
63 assert((
"operator-- results in negative index", index_ >= 0));
67 ContiguousConstIterator<Type> operator--(
int)
noexcept
74 ContiguousConstIterator<Type> &operator+=(
const difference_type offset)
noexcept
77 assert((
"operator+= results in negative index", index_ >= 0));
81 ContiguousConstIterator<Type> operator+(
const difference_type offset)
const noexcept
87 ContiguousConstIterator<Type> &operator-=(
const difference_type offset)
noexcept
89 return *
this += -offset;
92 ContiguousConstIterator<Type> operator-(
const difference_type offset)
const noexcept
98 difference_type operator-(
const ContiguousConstIterator<Type> &rhs)
const noexcept
100 assert((
"operator- results in negative index", index_ - rhs.index_ >= 0));
101 return index_ - rhs.index_;
104 reference operator[](
const difference_type offset)
const noexcept
106 return *(*
this + offset);
109 bool operator==(
const ContiguousConstIterator<Type> &rhs)
const noexcept
111 assert((
"iter to different buffer", ptr_ == rhs.ptr_));
112 return index_ == rhs.index_;
115 bool operator!=(
const ContiguousConstIterator<Type> &rhs)
const noexcept
117 return !(*
this == rhs);
120 bool operator<(
const ContiguousConstIterator<Type> &rhs)
const noexcept
122 return index_ < rhs.index_;
125 bool operator>(
const ContiguousConstIterator<Type> &rhs)
const noexcept
130 bool operator<=(
const ContiguousConstIterator<Type> &rhs)
const noexcept
132 return !(rhs < *
this);
135 bool operator>=(
const ContiguousConstIterator<Type> &rhs)
const noexcept
137 return !(*
this < rhs);
141 pointer ptr_ =
nullptr;
145 template <
class Type>
146 inline ContiguousConstIterator<Type>
operator+(
typename ContiguousConstIterator<Type>::difference_type offset,
147 ContiguousConstIterator<Type> next)
noexcept
149 return next += offset;
152 template <
class Type>
153 class ContiguousIterator :
public ContiguousConstIterator<Type>
156 using Allocator = std::allocator<Type>;
157 using AllocType =
typename std::allocator_traits<Allocator>::template rebind_alloc<Type>;
158 using AllocTraits = std::allocator_traits<AllocType>;
160 using Base = ContiguousConstIterator<Type>;
163 using iterator_category = std::random_access_iterator_tag;
164 using value_type = Type;
165 using pointer =
typename AllocTraits::pointer;
166 using reference = value_type &;
167 using difference_type =
typename AllocTraits::difference_type;
171 reference operator*() const noexcept
173 return const_cast<reference
>(Base::operator*());
176 pointer operator->() const noexcept
178 return const_cast<pointer
>(Base::operator->());
181 ContiguousIterator<Type> &operator++() noexcept
187 ContiguousIterator<Type> operator++(
int)
noexcept
194 ContiguousIterator<Type> &operator--() noexcept
200 ContiguousIterator<Type> operator--(
int)
noexcept
207 ContiguousIterator<Type> &operator+=(
const difference_type offset)
noexcept
209 Base::operator+=(offset);
213 ContiguousIterator<Type> operator+(
const difference_type offset)
const noexcept
216 return tmp += offset;
219 ContiguousIterator<Type> &operator-=(
const difference_type offset)
noexcept
221 Base::operator-=(offset);
225 using Base::operator-;
227 ContiguousIterator<Type> operator-(
const difference_type offset)
const noexcept
230 return tmp -= offset;
233 reference operator[](
const difference_type offset)
const noexcept
235 return const_cast<reference
>(Base::operator[](offset));
239 template <
class Type>
240 inline ContiguousIterator<Type>
operator+(
typename ContiguousIterator<Type>::difference_type offset,
241 ContiguousIterator<Type> next)
noexcept
243 return next += offset;
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
AffineMatrix2D operator+(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Add two affine matrices.
Definition affine_matrix_2d.hpp:223