48template <
typename derived_t, std::input_or_output_iterator base_t>
50 public std::conditional_t<std::is_pointer_v<base_t> || !std::semiregular<base_t>, empty_type, base_t>,
55 static constexpr bool wrap_base = std::is_pointer_v<base_t> || !std::semiregular<base_t>;
71#if SEQAN3_DOXYGEN_ONLY(1) 0
76 using iterator_concept = detail::iterator_concept_tag_t<base_t>;
86 std::is_nothrow_copy_constructible_v<base_t>) = default;
88 std::is_nothrow_move_constructible_v<base_t>) = default;
90 std::is_nothrow_copy_assignable_v<base_t>) = default;
92 std::is_nothrow_move_assignable_v<base_t>) = default;
98 : base_t{std::move(it)}
109 constexpr base_t
const &
base() const & noexcept
115 constexpr base_t &
base() &
noexcept
121 constexpr base_t
base() &&
noexcept
133 noexcept(
noexcept(std::declval<base_t &>() == std::declval<base_t &>()))
134 requires std::equality_comparable<base_t>
136 return base() == rhs.base();
141 noexcept(
noexcept(std::declval<base_t &>() == std::declval<base_t &>()))
142 requires std::equality_comparable<base_t>
144 return !(*
this == rhs);
149 noexcept(
noexcept(std::declval<base_t &>() < std::declval<base_t &>()))
150 requires std::totally_ordered<base_t>
152 return base() < rhs.base();
157 noexcept(
noexcept(std::declval<base_t &>() > std::declval<base_t &>()))
158 requires std::totally_ordered<base_t>
160 return base() > rhs.base();
165 noexcept(
noexcept(std::declval<base_t &>() > std::declval<base_t &>()))
166 requires std::totally_ordered<base_t>
168 return !(*
this > rhs);
173 noexcept(
noexcept(std::declval<base_t &>() < std::declval<base_t &>()))
174 requires std::totally_ordered<base_t>
176 return !(*
this < rhs);
186 template <
typename base_t_ = base_t>
189 requires requires (base_t_ i) { ++i; }
197 template <
typename base_t_ = base_t>
199 constexpr auto operator++(
int)
noexcept(
noexcept(std::declval<base_t &>()++))
200 requires requires (base_t_ i) {
202 requires !std::same_as<
decltype(i++), base_t_>;
210 template <
typename base_t_ = base_t>
213 operator++(
int)
noexcept(
noexcept(std::declval<base_t &>()++) &&
noexcept(
derived_t(std::declval<base_t &>())))
214 requires requires (base_t_ i) {
218 } -> std::same_as<base_t_>;
219 } && std::constructible_from<derived_t, base_t_>
226 template <
typename base_t_ = base_t>
229 requires requires (base_t_ i) { --i; }
237 template <
typename base_t_ = base_t>
240 operator--(
int)
noexcept(
noexcept(std::declval<base_t &>()--) &&
noexcept(
derived_t{std::declval<base_t &>()}))
241 requires requires (base_t_ i) { i--; } && std::constructible_from<derived_t, base_t_>
248 template <
typename base_t_ = base_t>
259 template <
typename base_t_ = base_t>
262 noexcept(
noexcept(std::declval<base_t &>() + skip) &&
noexcept(
derived_t{std::declval<base_t &>()}))
263 requires requires (base_t_
const i,
difference_type const n) { i + n; }
264 && std::constructible_from<derived_t, base_t_>
274 template <
typename base_t_ = base_t>
277 derived_t const & it)
noexcept(
noexcept(skip + std::declval<base_t const &>()))
279 && std::constructible_from<derived_t, base_t>
286 template <
typename base_t_ = base_t>
297 template <
typename base_t_ = base_t>
300 noexcept(
noexcept(std::declval<base_t const &>() - skip) &&
noexcept(
derived_t(std::declval<base_t &>())))
301 requires requires (base_t_ i,
difference_type const n) { i - n; } && std::constructible_from<derived_t, base_t_>
308 noexcept(
noexcept(std::declval<base_t &>() - std::declval<base_t &>()))
309 requires std::sized_sentinel_for<base_t, base_t>
311 return as_base() - rhs.as_base();
320 requires
std::indirectly_readable<base_t>
326 constexpr decltype(
auto)
operator*()
const noexcept(
noexcept(*std::declval<base_t const &>()))
327 requires std::indirectly_readable<base_t>
334 requires
std::input_iterator<base_t>
340 constexpr decltype(
auto) operator->() const noexcept(noexcept(*
std::declval<base_t const &>()))
341 requires
std::input_iterator<base_t>
348 template <
typename base_t_ = base_t>
350 constexpr decltype(
auto)
359 template <
typename base_t_ = base_t>
362 noexcept(
noexcept(std::declval<base_t const &>()[0]))
386 constexpr base_t
const &
as_base() const & noexcept
403 return static_cast<derived_t const *
>(
this);
A CRTP base template for creating iterators that inherit from other iterators.
Definition: inherited_iterator_base.hpp:52
constexpr derived_t operator++(int) noexcept(noexcept(std::declval< base_t & >()++) &&noexcept(derived_t(std::declval< base_t & >())))
Post-increment, return previous iterator state.
Definition: inherited_iterator_base.hpp:213
constexpr base_t base() &&noexcept
Returns an rvalue of the base.
Definition: inherited_iterator_base.hpp:121
constexpr pointer operator->() noexcept(noexcept(*std::declval< base_t & >()))
Return pointer to this iterator.
Definition: inherited_iterator_base.hpp:333
constexpr reference operator*() noexcept(noexcept(*std::declval< base_t & >()))
Dereference operator returns element currently pointed at.
Definition: inherited_iterator_base.hpp:319
constexpr bool operator==(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >()==std::declval< base_t & >()))
Checks whether *this is equal to rhs.
Definition: inherited_iterator_base.hpp:132
constexpr bool operator<(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >()< std::declval< base_t & >()))
Checks whether *this is less than rhs.
Definition: inherited_iterator_base.hpp:148
std::iter_difference_t< base_t > difference_type
The difference type.
Definition: inherited_iterator_base.hpp:64
maybe_present iterator_category
The iterator category tag.
Definition: inherited_iterator_base.hpp:73
static constexpr bool wrap_base
Whether this iterator inherits or wraps.
Definition: inherited_iterator_base.hpp:55
constexpr derived_t & operator+=(difference_type const skip) noexcept(noexcept(std::declval< base_t & >()+=skip))
Move iterator to the right.
Definition: inherited_iterator_base.hpp:250
constexpr auto operator++(int) noexcept(noexcept(std::declval< base_t & >()++))
Post-increment of input iterators that do not return a copy of themselves but void or a proxy type.
Definition: inherited_iterator_base.hpp:199
std::conditional_t< wrap_base, base_t, empty_type > member
If the base is a pointer, we wrap it instead of inheriting.
Definition: inherited_iterator_base.hpp:371
constexpr inherited_iterator_base(base_t it) noexcept
Initialise member if deriving from pointer.
Definition: inherited_iterator_base.hpp:102
detail::iter_pointer_t< base_t > pointer
The pointer type.
Definition: inherited_iterator_base.hpp:70
constexpr difference_type operator-(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >() - std::declval< base_t & >()))
Return offset between this and remote iterator's position.
Definition: inherited_iterator_base.hpp:307
constexpr derived_t operator+(difference_type const skip) const noexcept(noexcept(std::declval< base_t & >()+skip) &&noexcept(derived_t{std::declval< base_t & >()}))
Returns an iterator which is advanced by skip positions.
Definition: inherited_iterator_base.hpp:261
constexpr derived_t & operator-=(difference_type const skip) noexcept(noexcept(std::declval< base_t & >() -=skip))
Decrement iterator by skip.
Definition: inherited_iterator_base.hpp:288
constexpr derived_t operator--(int) noexcept(noexcept(std::declval< base_t & >() --) &&noexcept(derived_t{std::declval< base_t & >()}))
Post-decrement, return previous iterator state.
Definition: inherited_iterator_base.hpp:240
constexpr derived_t const * this_derived() const
Cast this to derived type.
Definition: inherited_iterator_base.hpp:401
constexpr derived_t & operator--() noexcept(noexcept(--std::declval< base_t & >()))
Pre-decrement, return updated iterator.
Definition: inherited_iterator_base.hpp:228
constexpr derived_t * this_derived()
Cast this to derived type.
Definition: inherited_iterator_base.hpp:395
constexpr base_t & base() &noexcept
Get a reference to the base.
Definition: inherited_iterator_base.hpp:115
constexpr bool operator>(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >() > std::declval< base_t & >()))
Checks whether *this is greater than rhs.
Definition: inherited_iterator_base.hpp:156
constexpr bool operator!=(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >()==std::declval< base_t & >()))
Checks whether *this is not equal to rhs.
Definition: inherited_iterator_base.hpp:140
constexpr base_t & as_base() &noexcept
Cast this to base type.
Definition: inherited_iterator_base.hpp:377
constexpr bool operator<=(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >() > std::declval< base_t & >()))
Checks whether *this is less than or equal to rhs.
Definition: inherited_iterator_base.hpp:164
constexpr derived_t & operator++() noexcept(noexcept(++std::declval< base_t & >()))
Pre-increment, return updated iterator.
Definition: inherited_iterator_base.hpp:188
constexpr base_t const & base() const &noexcept
Get a const reference to the base.
Definition: inherited_iterator_base.hpp:109
friend derived_t
Befriend the derived type so it can access the private members.
Definition: inherited_iterator_base.hpp:374
constexpr inherited_iterator_base() noexcept(std::is_nothrow_default_constructible_v< base_t >)=default
Defaulted.
constexpr base_t const & as_base() const &noexcept
Cast this to base type.
Definition: inherited_iterator_base.hpp:386
constexpr friend derived_t operator+(difference_type const skip, derived_t const &it) noexcept(noexcept(skip+std::declval< base_t const & >()))
Non-member operator+ delegates to non-friend operator+.
Definition: inherited_iterator_base.hpp:276
constexpr bool operator>=(derived_t const &rhs) const noexcept(noexcept(std::declval< base_t & >()< std::declval< base_t & >()))
Checks whether *this is greater than or equal to rhs.
Definition: inherited_iterator_base.hpp:172
constexpr derived_t operator-(difference_type const skip) const noexcept(noexcept(std::declval< base_t const & >() - skip) &&noexcept(derived_t(std::declval< base_t & >())))
Return decremented copy of this iterator.
Definition: inherited_iterator_base.hpp:299
Provides seqan3::detail::empty_type.
typename iter_pointer< it_t >::type iter_pointer_t
Return the pointer type of the input type (transformation_trait shortcut).
Definition: iterator_traits.hpp:166
Provides various transformation traits for use on iterators.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
This handles more cases than maybe_iterator_category if you inherit the underling_iterator_t.
Definition: iterator_traits.hpp:92