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();
284template <
class SetType>
287 using T =
typename SetType::Item_Type;
288 using Itor =
typename SetType::Iterator;
294 std::conditional_t<AlephRandomAccessItor<Itor>, std::random_access_iterator_tag, std::forward_iterator_tag>;
329 if constexpr (
requires(
const Itor &a,
const Itor &b) {
330 { a == b } -> std::convertible_to<bool>;
332 return static_cast<const Itor &
>(*
this) ==
static_cast<const Itor &
>(it);
334 if (this->has_curr() and it.has_curr())
335 return this->get_pos() == it.get_pos();
337 if (not this->has_curr() and not it.has_curr())
346 return not (*
this == it);
352 return this->get_curr();
358 return &this->get_curr();
388 this->set_pos(this->get_pos() + n);
396 this->set_pos(this->get_pos() - n);
445 return this->get_pos() <=> it.get_pos();
470template <
class SetName>
475 return static_cast<SetName *
>(
this);
480 return static_cast<const SetName *
>(
this);
563template <
class Container>
567 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.
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.
Main namespace for Aleph-w library functions.
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.