13 template<
class container_t>
14 constexpr base_iterator<container_t>::operator
void*() noexcept
16 return &(*m_pContainer).at(m_nIndex);
19 template<
class container_t>
20 constexpr
void base_iterator<container_t>::shift(difference_type nShift) noexcept
25 template<
class container_t>
26 constexpr decltype(
auto) base_iterator<container_t>::get(difference_type nShift) const noexcept
28 return (*m_pContainer).at(m_nIndex + nShift);
31 template<
class container_t>
32 constexpr
auto base_iterator<container_t>::get_address() const noexcept
34 auto pData = m_pContainer->data();
35 return pData ? pData + m_nIndex : pData;
38 template<
class container_t>
39 constexpr
typename base_iterator<container_t>::size_type base_iterator<container_t>::get_index() const noexcept
44 template<
class container_t,
class derived_t>
45 template<
class iterator_t>
46 requires derived_from_template_c<iterator_t, base_iterator>
47 constexpr
typename base_forward_iterator<container_t, derived_t>::super_type::difference_type base_forward_iterator<
49 derived_t>::operator-(
const iterator_t& r)
const noexcept
51 return static_cast<typename super_type::difference_type
>(super_type::get_index() - r.get_index());
54 template<
class container_t,
class derived_t>
55 constexpr
bool base_forward_iterator<container_t, derived_t>::operator<(
const base_forward_iterator& r)
const noexcept
57 return super_type::get_index() < r.get_index();
60 template<
class container_t,
class derived_t>
61 constexpr
bool base_forward_iterator<container_t, derived_t>::operator<=(
const base_forward_iterator& r)
const noexcept
63 return super_type::get_index() <= r.get_index();
66 template<
class container_t,
class derived_t>
67 constexpr
bool base_forward_iterator<container_t, derived_t>::operator>(
const base_forward_iterator& r)
const noexcept
69 return super_type::get_index() > r.get_index();
72 template<
class container_t,
class derived_t>
73 constexpr
bool base_forward_iterator<container_t, derived_t>::operator>=(
const base_forward_iterator& r)
const noexcept
75 return super_type::get_index() >= r.get_index();
78 template<
class container_t,
class derived_t>
79 constexpr
bool base_forward_iterator<container_t, derived_t>::operator!=(
const base_forward_iterator& r)
const noexcept
81 return super_type::get_index() != r.get_index();
84 template<
class container_t,
class derived_t>
85 constexpr
bool base_forward_iterator<container_t, derived_t>::operator==(
const base_forward_iterator& r)
const noexcept
87 return super_type::get_index() == r.get_index();
90 template<
class container_t,
class derived_t>
91 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
93 derived_t>::operator++() noexcept
96 return static_cast<decayed_derived_type&
>(*this);
99 template<
class container_t,
class derived_t>
100 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
102 derived_t>::operator--() noexcept
104 super_type::shift(-1);
105 return static_cast<decayed_derived_type&
>(*this);
108 template<
class container_t,
class derived_t>
109 [[nodiscard]] constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type
110 base_forward_iterator<container_t, derived_t>::operator++(
int) noexcept
112 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
113 super_type::shift(1);
117 template<
class container_t,
class derived_t>
118 [[nodiscard]] constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type
119 base_forward_iterator<container_t, derived_t>::operator--(
int) noexcept
121 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
122 super_type::shift(-1);
126 template<
class container_t,
class derived_t>
127 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
129 derived_t>::operator+=(
typename super_type::difference_type n) noexcept
131 super_type::shift(n);
132 return static_cast<decayed_derived_type&
>(*this);
135 template<
class container_t,
class derived_t>
136 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
138 derived_t>::operator-=(
typename super_type::difference_type n) noexcept
140 super_type::shift(-n);
141 return static_cast<decayed_derived_type&
>(*this);
144 template<
class container_t,
class derived_t>
145 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type base_forward_iterator<
147 derived_t>::operator+(
typename super_type::difference_type n)
const noexcept
149 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
153 template<
class container_t,
class derived_t>
154 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type base_forward_iterator<
156 derived_t>::operator-(
typename super_type::difference_type n)
const noexcept
158 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
162 template<
class iterator_t>
163 requires derived_from_template_c<iterator_t, base_forward_iterator>
164 constexpr iterator_t operator+(
typename iterator_t::size_type n, iterator_t it) noexcept
169 template<
class container_t,
class derived_t>
170 template<
class iterator_t>
171 requires derived_from_template_c<iterator_t, base_iterator>
172 constexpr
typename base_reverse_iterator<container_t, derived_t>::super_type::difference_type base_reverse_iterator<
174 derived_t>::operator-(
const iterator_t& r)
const noexcept
176 return static_cast<typename super_type::difference_type
>(r.get_index() - super_type::get_index());
179 template<
class container_t,
class derived_t>
180 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator<(
const base_reverse_iterator& r)
const noexcept
182 return super_type::get_index() + 1 > r.get_index() + 1;
185 template<
class container_t,
class derived_t>
186 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator<=(
const base_reverse_iterator& r)
const noexcept
188 return super_type::get_index() + 1 >= r.get_index() + 1;
191 template<
class container_t,
class derived_t>
192 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator>(
const base_reverse_iterator& r)
const noexcept
194 return super_type::get_index() + 1 < r.get_index() + 1;
197 template<
class container_t,
class derived_t>
198 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator>=(
const base_reverse_iterator& r)
const noexcept
200 return super_type::get_index() + 1 <= r.get_index() + 1;
203 template<
class container_t,
class derived_t>
204 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator!=(
const base_reverse_iterator& r)
const noexcept
206 return super_type::get_index() + 1 != r.get_index() + 1;
209 template<
class container_t,
class derived_t>
210 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator==(
const base_reverse_iterator& r)
const noexcept
212 return super_type::get_index() + 1 == r.get_index() + 1;
215 template<
class container_t,
class derived_t>
216 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
218 derived_t>::operator++() noexcept
220 super_type::shift(-1);
221 return static_cast<decayed_derived_type&
>(*this);
224 template<
class container_t,
class derived_t>
225 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
227 derived_t>::operator--() noexcept
229 super_type::shift(1);
230 return static_cast<decayed_derived_type&
>(*this);
233 template<
class container_t,
class derived_t>
234 [[nodiscard]] constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type
235 base_reverse_iterator<container_t, derived_t>::operator++(
int) noexcept
237 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
238 super_type::shift(-1);
242 template<
class container_t,
class derived_t>
243 [[nodiscard]] constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type
244 base_reverse_iterator<container_t, derived_t>::operator--(
int) noexcept
246 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
247 super_type::shift(1);
251 template<
class container_t,
class derived_t>
252 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
254 derived_t>::operator+=(
typename super_type::difference_type n) noexcept
256 super_type::shift(-n);
257 return static_cast<decayed_derived_type&
>(*this);
260 template<
class container_t,
class derived_t>
261 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
263 derived_t>::operator-=(
typename super_type::difference_type n) noexcept
265 super_type::shift(n);
266 return static_cast<decayed_derived_type&
>(*this);
269 template<
class container_t,
class derived_t>
270 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type base_reverse_iterator<
272 derived_t>::operator+(
typename super_type::difference_type n)
const noexcept
274 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
278 template<
class container_t,
class derived_t>
279 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type base_reverse_iterator<
281 derived_t>::operator-(
typename super_type::difference_type n)
const noexcept
283 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
287 template<
class iterator_t>
288 requires derived_from_template_c<iterator_t, base_reverse_iterator>
289 constexpr iterator_t operator+(
typename iterator_t::size_type n, iterator_t it) noexcept
requires(same_variadic_args_v< args_t... >) const expr auto coalesce(args_t &&... args)
Coalesce function, C# a ?? b analogue.