60 template <
typename T>
class DynList;
74 std::same_as<typename I::aleph_random_access_iterator, I> and
75 requires(I &it,
const I &cit,
long n) {
76 { cit.get_pos() } -> std::convertible_to<long>;
97template <
class SetType>
100 using T =
typename SetType::Item_Type;
101 using Itor =
typename SetType::Iterator;
107 std::conditional_t<AlephRandomAccessItor<Itor>, std::random_access_iterator_tag, std::forward_iterator_tag>;
112 using reference =
decltype(std::declval<const Itor &>().get_curr());
114 using pointer = std::add_pointer_t<std::remove_reference_t<reference>>;
142 if constexpr (
requires(
const Itor &a,
const Itor &b) {
143 { a == b } -> std::convertible_to<bool>;
145 return static_cast<const Itor &
>(*
this) ==
static_cast<const Itor &
>(it);
147 if (this->has_curr() and it.has_curr())
148 return this->get_pos() == it.get_pos();
151 if (not this->has_curr() and not it.has_curr())
160 return not (*
this == it);
168 return this->get_curr();
174 return &this->get_curr();
203 this->set_pos(this->get_pos() + n);
211 this->set_pos(this->get_pos() - n);
260 return this->get_pos() <=> it.get_pos();
281namespace const_iterator_detail
345 if constexpr (
requires {
It(c); })
348 return It(
const_cast<C &
>(c));
365 std::conditional_t<AlephRandomAccessItor<It>,
Const_Iterator,
void>;
374 requires (not std::same_as<std::remove_cvref_t<C>,
Const_Iterator>
375 and not std::same_as<std::remove_cvref_t<C>,
It>)
385 template <
class I = It>
389 return it.has_curr();
397 template <
class I = It>
399 -> const_iterator_detail::const_item_t<decltype(
std::declval<I &>().
get_curr())>
401 return it.get_curr();
405 template <
class I = It>
407 -> const_iterator_detail::const_item_t<decltype(
std::declval<I &>().
get_curr_ne())>
409 return it.get_curr_ne();
413 template <
class I = It>
420 template <
class I = It>
427 template <
class I = It>
434 template <
class I = It>
441 template <
class I = It>
445 return it.reset_first();
449 template <
class I = It>
453 return it.reset_last();
457 template <
class I = It>
464 template <
class I = It>
465 auto end() noexcept(noexcept(
std::declval<I &>().
end())) -> decltype(
std::declval<I &>().
end())
471 template <
class I = It>
479 template <
class I = It>
480 auto set_pos(
const long pos)
noexcept(
noexcept(std::declval<I &>().set_pos(pos)))
481 ->
decltype(std::declval<I &>().set_pos(pos))
483 return it.set_pos(pos);
487 template <
class I = It>
495 template <
class I = It>
499 return it.is_in_first();
503 template <
class I = It>
507 return it.is_in_last();
518 template <
class I = It>
520 ->
decltype(std::declval<I &>() == std::declval<I &>())
522 return it == other.it;
526 template <
class I = It>
528 ->
decltype(not (std::declval<I &>() == std::declval<I &>()))
530 return not (
it == other.it);
546 requires (not std::is_const_v<C>)
549 return typename C::Iterator(c);
571template <
class SetType>
574 using T =
typename SetType::Item_Type;
575 using Itor =
typename SetType::Iterator;
582 std::conditional_t<AlephRandomAccessItor<Itor>, std::random_access_iterator_tag, std::forward_iterator_tag>;
618 if constexpr (
requires(
const Base &a,
const Base &b) {
619 { a == b } -> std::convertible_to<bool>;
621 return static_cast<const Base &
>(*
this) ==
static_cast<const Base &
>(
it);
626 if (not this->
has_curr() and not
it.has_curr())
635 return not (*
this ==
it);
734 return this->
get_pos() <=> it.get_pos();
759template <
class SetName>
764 return static_cast<SetName *
>(
this);
769 return static_cast<const SetName *
>(
this);
852template <
class Container>
856 for (
const auto &i : c)
Aleph::DynList< typename Container::value_type > extract_from_stl_container(const Container &c)
Extract all items from an STL container into an Aleph DynList.
Read-only view of an Aleph iterator: the iterator of a constant container.
It & underlying() const noexcept
The underlying iterator, for the views that extend the reading protocol with members of their own (th...
auto reset_first() noexcept(noexcept(std::declval< I & >().reset_first())) -> decltype(std::declval< I & >().reset_first())
Position the view on the first item.
auto is_in_last() const noexcept(noexcept(std::declval< I & >().is_in_last())) -> decltype(std::declval< I & >().is_in_last())
true if the current item is the last one.
Const_Iterator(const C &c)
View positioned on the first item of the container c.
auto operator==(const Const_Iterator &other) const -> decltype(std::declval< I & >()==std::declval< I & >())
Equality of the underlying iterators, when they have it.
std::conditional_t< AlephRandomAccessItor< It >, Const_Iterator, void > aleph_random_access_iterator
Random access when the underlying iterator opts in; see AlephRandomAccessItor.
auto reset_last() noexcept(noexcept(std::declval< I & >().reset_last())) -> decltype(std::declval< I & >().reset_last())
Position the view on the last item.
auto get_pos() const noexcept(noexcept(std::declval< I & >().get_pos())) -> decltype(std::declval< I & >().get_pos())
Ordinal position of the current item.
auto prev() noexcept(noexcept(std::declval< I & >().prev())) -> decltype(std::declval< I & >().prev())
Move to the previous item; what the underlying iterator throws.
auto reset() noexcept(noexcept(std::declval< I & >().reset())) -> decltype(std::declval< I & >().reset())
Position the view on the first item.
auto is_in_first() const noexcept(noexcept(std::declval< I & >().is_in_first())) -> decltype(std::declval< I & >().is_in_first())
true if the current item is the first one.
void swap(Const_Iterator &other) noexcept(std::is_nothrow_swappable_v< It >)
Exchange the views.
auto end() noexcept(noexcept(std::declval< I & >().end())) -> decltype(std::declval< I & >().end())
Position the view past the last item.
static It make(const C &c)
auto next() noexcept(noexcept(std::declval< I & >().next())) -> decltype(std::declval< I & >().next())
Move to the next item; what the underlying iterator throws.
Const_Iterator()=default
A view with no current item.
auto has_curr() const noexcept(noexcept(std::declval< I & >().has_curr())) -> decltype(std::declval< I & >().has_curr())
true if there is a current item.
auto is_last() const noexcept(noexcept(std::declval< I & >().is_last())) -> decltype(std::declval< I & >().is_last())
true if the current item is the last one.
auto operator!=(const Const_Iterator &other) const -> decltype(not(std::declval< I & >()==std::declval< I & >()))
Negation of ==.
auto set_pos(const long pos) noexcept(noexcept(std::declval< I & >().set_pos(pos))) -> decltype(std::declval< I & >().set_pos(pos))
Position the view on the item at ordinal position pos.
auto get_curr_ne() const noexcept(noexcept(std::declval< I & >().get_curr_ne())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr_ne())>
get_curr() without the checks of the underlying iterator.
auto get_curr() const noexcept(noexcept(std::declval< I & >().get_curr())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr())>
The current item, read-only.
It Itor
The underlying iterator.
Const_Iterator(It underlying) noexcept(std::is_nothrow_move_constructible_v< It >)
Read-only view over an existing iterator.
auto next_ne() noexcept(noexcept(std::declval< I & >().next_ne())) -> decltype(std::declval< I & >().next_ne())
next() without checks.
auto prev_ne() noexcept(noexcept(std::declval< I & >().prev_ne())) -> decltype(std::declval< I & >().prev_ne())
prev() without checks.
Doubly-linked list (defined in tpl_dynList.H).
T & append(const T &item)
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
friend const_iterator end(const SetName &s) noexcept
const_iterator begin() const noexcept
Return a const iterator to the first element.
friend const_iterator cbegin(const SetName &s) noexcept
friend const_iterator cend(const SetName &s) noexcept
const_iterator cbegin() const noexcept
Return a const iterator to the first element.
const_iterator cend() const noexcept
Return a const end iterator.
friend iterator end(SetName &s) noexcept
const SetName * const_me() const
friend iterator begin(SetName &s) noexcept
iterator end() noexcept
Return an STL-compatible end iterator.
const_iterator end() const noexcept
Return a const end iterator.
friend const_iterator begin(const SetName &s) noexcept
iterator begin() noexcept
Return an STL-compatible iterator to the first element.
Detects Aleph iterators that opted in to random-access promotion.
typename const_item< std::remove_cv_t< R > >::type const_item_t
Main namespace for Aleph-w library functions.
std::decay_t< typename HeadC::Item_Type > T
and
Check uniqueness with explicit hash + equality functors.
auto iterator_for(C &c)
Iterator on c positioned on its first item: the container's own iterator on a modifiable container.
What a read-only view hands out for an item handed out as R: a reference becomes a reference to const...
typename It::Item_Type Item_Type
The type of the items, as in the underlying iterator.
Carries the Item_Type of the iterator It, when it has one.
typename It::Set_Type Set_Type
The type of the container, as in the underlying iterator.
Carries the Set_Type of the iterator It, when it has one, on top of its Item_Type.
STL-compatible const iterator adapter for Aleph containers.
const T & operator*() const
Dereference: return the current element.
StlConstIterator() noexcept=default
Default constructor creates an "end" iterator (no current element).
typename SetType::Iterator Itor
typename SetType::Item_Type T
static StlConstIterator cbegin(const SetType &s)
Create a const iterator positioned at the first element of the container.
friend StlConstIterator operator+(difference_type n, const StlConstIterator &it)
Return an iterator advanced n positions (symmetric form).
const T * operator->() const
Member access to the current element.
bool operator==(const StlConstIterator &it) const
Equality compares positions when both iterators are valid; otherwise both must be in the end state.
std::strong_ordering operator<=>(const StlConstIterator &it) const
Order two iterators by their logical position.
std::ptrdiff_t difference_type
std::conditional_t< AlephRandomAccessItor< Itor >, std::random_access_iterator_tag, std::forward_iterator_tag > iterator_category
Category is promoted to random-access when the underlying Aleph iterator opts in (see AlephRandomAcce...
bool operator!=(const StlConstIterator &it) const
Inequality.
StlConstIterator & operator++()
Pre-increment: advance to the next element.
static StlConstIterator cend(const SetType &s)
Create a const end iterator for the container.
iterator_category iterator_concept
StlConstIterator operator-(difference_type n) const
Return an iterator moved back n positions.
StlConstIterator & operator--()
Pre-decrement: move to the previous element.
reference operator[](difference_type n) const
Access the element n positions away from the current one.
StlConstIterator & operator+=(difference_type n)
Advance the iterator n positions (n may be negative).
StlConstIterator & operator-=(difference_type n)
Move the iterator back n positions (n may be negative).
STL-compatible mutable iterator adapter for Aleph containers.
std::add_pointer_t< std::remove_reference_t< reference > > pointer
std::strong_ordering operator<=>(const StlIterator &it) const
Order two iterators by their logical position.
bool operator!=(const StlIterator &it) const
Inequality.
friend StlIterator operator+(difference_type n, const StlIterator &it)
Return an iterator advanced n positions (symmetric form).
decltype(std::declval< const Itor & >().get_curr()) reference
typename SetType::Iterator Itor
std::ptrdiff_t difference_type
static StlIterator begin(SetType &s)
Create an iterator positioned at the first element of the container.
StlIterator & operator-=(difference_type n)
Move the iterator back n positions (n may be negative).
StlIterator operator-(difference_type n) const
Return an iterator moved back n positions.
std::conditional_t< AlephRandomAccessItor< Itor >, std::random_access_iterator_tag, std::forward_iterator_tag > iterator_category
Category is promoted to random-access when the underlying Aleph iterator opts in (see AlephRandomAcce...
StlIterator & operator+=(difference_type n)
Advance the iterator n positions (n may be negative).
static StlIterator end(SetType &s)
Create an end iterator for the container.
StlIterator() noexcept=default
Default constructor creates an "end" iterator (no current element).
pointer operator->() const
Member access to the current element.
StlIterator & operator++()
Pre-increment: advance to the next element.
bool operator==(const StlIterator &it) const
Equality compares positions when both iterators are valid; otherwise both must be in the end state.
iterator_category iterator_concept
reference operator*() const
Dereference: return the current element.
typename SetType::Item_Type T
reference operator[](difference_type n) const
Access the element n positions away from the current one.
StlIterator & operator--()
Pre-decrement: move to the previous element.
Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par > It