49# include <type_traits>
68 template <
class SetType>
71 using T =
typename SetType::Item_Type;
72 using Itor =
typename SetType::Iterator;
78 using reference =
decltype(std::declval<const Itor &>().get_curr());
80 using pointer = std::add_pointer_t<std::remove_reference_t<reference>>;
108 if constexpr (
requires (
const Itor & a,
const Itor & b)
110 { a == b } -> std::convertible_to<bool>;
112 return static_cast<const Itor &
>(*
this) ==
static_cast<const Itor &
>(it);
114 if (this->has_curr() and it.has_curr())
115 return this->get_pos() == it.get_pos();
118 if (not this->has_curr() and not it.has_curr())
127 return not (*
this == it);
160 template <
class SetType>
163 using T =
typename SetType::Item_Type;
164 using Itor =
typename SetType::Iterator;
200 if constexpr (
requires (
const Itor & a,
const Itor & b)
202 { a == b } -> std::convertible_to<bool>;
204 return static_cast<const Itor &
>(*
this) ==
static_cast<const Itor &
>(it);
206 if (this->has_curr() and it.has_curr())
207 return this->get_pos() == it.get_pos();
209 if (not this->has_curr() and not it.has_curr())
218 return not (*
this == it);
250 template <
class SetName>
253 SetName *
me() {
return static_cast<SetName*
>(
this); }
255 const SetName *
const_me()
const {
return static_cast<const SetName*
>(
this); }
315template <
class Container>
inline
320 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.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
Append a new item by copy.
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.
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.
const T * operator->() const
Member access to the current element.
std::forward_iterator_tag iterator_concept
bool operator==(const StlConstIterator &it) const
Equality compares positions when both iterators are valid; otherwise both must be in the end state.
std::ptrdiff_t difference_type
bool operator!=(const StlConstIterator &it) const
Inequality.
std::forward_iterator_tag iterator_category
StlConstIterator & operator++()
Pre-increment: advance to the next element.
static StlConstIterator cend(const SetType &s)
Create a const end iterator for the container.
STL-compatible mutable iterator adapter for Aleph containers.
std::add_pointer_t< std::remove_reference_t< reference > > pointer
bool operator!=(const StlIterator &it) const
Inequality.
std::forward_iterator_tag iterator_category
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.
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.
std::forward_iterator_tag iterator_concept
reference operator*() const
Dereference: return the current element.
typename SetType::Item_Type T