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
typename base_iterator<container_t>::size_type base_iterator<container_t>::get_index() const noexcept
37 template<
class container_t,
class derived_t>
38 template<
class iterator_t>
39 requires derived_from_template_c<iterator_t, base_iterator>
40 constexpr
typename base_forward_iterator<container_t, derived_t>::super_type::difference_type base_forward_iterator<
42 derived_t>::operator-(
const iterator_t& r)
const noexcept
44 return static_cast<typename super_type::difference_type
>(super_type::get_index() - r.get_index());
47 template<
class container_t,
class derived_t>
48 constexpr
bool base_forward_iterator<container_t, derived_t>::operator<(
const base_forward_iterator& r)
const noexcept
50 return super_type::get_index() < r.get_index();
53 template<
class container_t,
class derived_t>
54 constexpr
bool base_forward_iterator<container_t, derived_t>::operator<=(
const base_forward_iterator& r)
const noexcept
56 return super_type::get_index() <= r.get_index();
59 template<
class container_t,
class derived_t>
60 constexpr
bool base_forward_iterator<container_t, derived_t>::operator>(
const base_forward_iterator& r)
const noexcept
62 return super_type::get_index() > r.get_index();
65 template<
class container_t,
class derived_t>
66 constexpr
bool base_forward_iterator<container_t, derived_t>::operator>=(
const base_forward_iterator& r)
const noexcept
68 return super_type::get_index() >= r.get_index();
71 template<
class container_t,
class derived_t>
72 constexpr
bool base_forward_iterator<container_t, derived_t>::operator!=(
const base_forward_iterator& r)
const noexcept
74 return super_type::get_index() != r.get_index();
77 template<
class container_t,
class derived_t>
78 constexpr
bool base_forward_iterator<container_t, derived_t>::operator==(
const base_forward_iterator& r)
const noexcept
80 return super_type::get_index() == r.get_index();
83 template<
class container_t,
class derived_t>
84 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
86 derived_t>::operator++() noexcept
89 return static_cast<decayed_derived_type&
>(*this);
92 template<
class container_t,
class derived_t>
93 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
95 derived_t>::operator--() noexcept
97 super_type::shift(-1);
98 return static_cast<decayed_derived_type&
>(*this);
101 template<
class container_t,
class derived_t>
102 [[nodiscard]] constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type
103 base_forward_iterator<container_t, derived_t>::operator++(
int) noexcept
105 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
106 super_type::shift(1);
110 template<
class container_t,
class derived_t>
111 [[nodiscard]] constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type
112 base_forward_iterator<container_t, derived_t>::operator--(
int) noexcept
114 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
115 super_type::shift(-1);
119 template<
class container_t,
class derived_t>
120 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
122 derived_t>::operator+=(
typename super_type::difference_type n) noexcept
124 super_type::shift(n);
125 return static_cast<decayed_derived_type&
>(*this);
128 template<
class container_t,
class derived_t>
129 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type& base_forward_iterator<
131 derived_t>::operator-=(
typename super_type::difference_type n) noexcept
133 super_type::shift(-n);
134 return static_cast<decayed_derived_type&
>(*this);
137 template<
class container_t,
class derived_t>
138 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type base_forward_iterator<
140 derived_t>::operator+(
typename super_type::difference_type n)
const noexcept
142 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
146 template<
class container_t,
class derived_t>
147 constexpr
typename base_forward_iterator<container_t, derived_t>::decayed_derived_type base_forward_iterator<
149 derived_t>::operator-(
typename super_type::difference_type n)
const noexcept
151 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
155 template<
class iterator_t>
156 requires derived_from_template_c<iterator_t, base_forward_iterator>
157 constexpr iterator_t operator+(
typename iterator_t::size_type n, iterator_t it) noexcept
162 template<
class container_t,
class derived_t>
163 template<
class iterator_t>
164 requires derived_from_template_c<iterator_t, base_iterator>
165 constexpr
typename base_reverse_iterator<container_t, derived_t>::super_type::difference_type base_reverse_iterator<
167 derived_t>::operator-(
const iterator_t& r)
const noexcept
169 return static_cast<typename super_type::difference_type
>(r.get_index() - super_type::get_index());
172 template<
class container_t,
class derived_t>
173 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator<(
const base_reverse_iterator& r)
const noexcept
175 return super_type::get_index() + 1 > r.get_index() + 1;
178 template<
class container_t,
class derived_t>
179 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator<=(
const base_reverse_iterator& r)
const noexcept
181 return super_type::get_index() + 1 >= r.get_index() + 1;
184 template<
class container_t,
class derived_t>
185 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator>(
const base_reverse_iterator& r)
const noexcept
187 return super_type::get_index() + 1 < r.get_index() + 1;
190 template<
class container_t,
class derived_t>
191 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator>=(
const base_reverse_iterator& r)
const noexcept
193 return super_type::get_index() + 1 <= r.get_index() + 1;
196 template<
class container_t,
class derived_t>
197 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator!=(
const base_reverse_iterator& r)
const noexcept
199 return super_type::get_index() + 1 != r.get_index() + 1;
202 template<
class container_t,
class derived_t>
203 constexpr
bool base_reverse_iterator<container_t, derived_t>::operator==(
const base_reverse_iterator& r)
const noexcept
205 return super_type::get_index() + 1 == r.get_index() + 1;
208 template<
class container_t,
class derived_t>
209 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
211 derived_t>::operator++() noexcept
213 super_type::shift(-1);
214 return static_cast<decayed_derived_type&
>(*this);
217 template<
class container_t,
class derived_t>
218 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
220 derived_t>::operator--() noexcept
222 super_type::shift(1);
223 return static_cast<decayed_derived_type&
>(*this);
226 template<
class container_t,
class derived_t>
227 [[nodiscard]] constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type
228 base_reverse_iterator<container_t, derived_t>::operator++(
int) noexcept
230 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
231 super_type::shift(-1);
235 template<
class container_t,
class derived_t>
236 [[nodiscard]] constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type
237 base_reverse_iterator<container_t, derived_t>::operator--(
int) noexcept
239 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
240 super_type::shift(1);
244 template<
class container_t,
class derived_t>
245 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
247 derived_t>::operator+=(
typename super_type::difference_type n) noexcept
249 super_type::shift(-n);
250 return static_cast<decayed_derived_type&
>(*this);
253 template<
class container_t,
class derived_t>
254 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type& base_reverse_iterator<
256 derived_t>::operator-=(
typename super_type::difference_type n) noexcept
258 super_type::shift(n);
259 return static_cast<decayed_derived_type&
>(*this);
262 template<
class container_t,
class derived_t>
263 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type base_reverse_iterator<
265 derived_t>::operator+(
typename super_type::difference_type n)
const noexcept
267 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
271 template<
class container_t,
class derived_t>
272 constexpr
typename base_reverse_iterator<container_t, derived_t>::decayed_derived_type base_reverse_iterator<
274 derived_t>::operator-(
typename super_type::difference_type n)
const noexcept
276 decayed_derived_type r(
static_cast<const decayed_derived_type&
>(*
this));
280 template<
class iterator_t>
281 requires derived_from_template_c<iterator_t, base_reverse_iterator>
282 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.