44# ifndef TPL_DYNLISTQUEUE_H
45# define TPL_DYNLISTQUEUE_H
48# include <type_traits>
120 [[nodiscard]]
size_t size() const noexcept {
return q.
size(); }
150 return q.
append(std::forward<T>(data));
157 return put(std::forward<T>(data));
164 return put(std::forward<T>(data));
176 template <
typename... Args>
179 return put(
T(std::forward<Args>(args)...));
259 template <
class Operation>
262 noexcept(
noexcept(
q.
traverse(operation)))
268 template <
class Operation>
271 noexcept(
noexcept(
q.
traverse(operation)))
277 template <
class Operation>
279 bool traverse(Operation && operation = Operation()) const
280 noexcept(noexcept(
q.
traverse(operation)))
282 return q.
traverse(std::forward<Operation>(operation));
286 template <
class Operation>
288 bool traverse(Operation && operation = Operation())
289 noexcept(noexcept(
q.
traverse(operation)))
291 return q.
traverse(std::forward<Operation>(operation));
302 noexcept(
noexcept(
static_cast<bool>(std::declval<const T &>() == std::declval<const T &>())))
304 return this->
find_ptr([&key](
const T & item) {
return static_cast<bool>(item == key); });
309 noexcept(
noexcept(
static_cast<bool>(std::declval<const T &>() == std::declval<const T &>())))
311 return this->
find_ptr([&key](
const T & item) {
return static_cast<bool>(item == key); });
Variadic constructor macros for containers.
STL-compatible iterator adapters for Aleph containers.
DRY (Don't Repeat Yourself) utilities and macros.
#define Special_Ctors(Set_Type, Type)
Generates special constructors for containers.
Iterator traits and STL-compatible iterator wrappers.
Read-only view of an Aleph iterator: the iterator of a constant container.
Dynamic queue of elements of generic type T based on single linked list.
const T & front() const
Return a const reference to the oldest item in the queue.
DynListQueue & operator=(const DynListQueue &rhs)
Assign to this a copy of rhs
T & put(const T &data)
The type of element.
DynListQueue(DynListQueue &&__q) noexcept
Construct in constant time a queue from __q
T Key_Type
Alias for the item type.
const T * search(const T &key) const noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >())))
See search(const T & key).
T get()
Remove the oldest item of the queue.
const T & rear() const
Return a const reference to the youngest item in the queue.
bool traverse(Operation &&operation=Operation()) noexcept(noexcept(q.traverse(operation)))
See traverse (Operation & operation).
bool traverse(Operation &operation) const noexcept(noexcept(q.traverse(operation)))
See traverse(Operation & operation).
void swap(DynListQueue &__q) noexcept
Swap this with __q in constant time.
void empty() noexcept
Empty the queue.
T * search(const T &key) noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >())))
Search for an item in the queue using equality comparison.
T & put(T &&data)
Put an item by moving.
T & front()
Return a modifiable reference to the oldest item in the queue.
void clear() noexcept
Empties the container.
T pop()
Alias for get() - removes and returns the front item.
T & insert(const T &data)
T & append(const T &data)
T & emplace(Args &&... args)
Construct an item in place at the rear of the queue.
DynListQueue() noexcept
Construct an empty queue.
bool traverse(Operation &operation) noexcept(noexcept(q.traverse(operation)))
Traverse all the elements from the oldest (front) to the youngest (rear) and execute operation on eac...
size_t size() const noexcept
Return the number of elements.
bool traverse(Operation &&operation=Operation()) const noexcept(noexcept(q.traverse(operation)))
See traverse (Operation & operation).
DynListQueue(const DynListQueue &__q)
Construct a copy of __q
T Item_Type
The type of set.
T & rear()
Return a modifiable reference to the youngest item in the queue.
bool is_empty() const noexcept
Return true if this is empty.
Iterator on the items of list.
Doubly-linked list (defined in tpl_dynList.H).
T & get_first()
Return the first item of the list.
T & append(const T &item)
T & get_last()
Return the last item of the list.
T remove_first()
See remove().
size_t size() const noexcept
Return the number of items of the list, in constant time.
void empty() noexcept
empty the list
DynList & swap(DynList &l) noexcept
constexpr bool is_empty() const noexcept
Mixin providing equality comparison for sequence containers.
Common methods to the Aleph-w ( ) containers.
Common sequential searching methods on containers.
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListQueue< T >, Operation >::type, T > T * find_ptr(Operation &operation) noexcept(mutable_search_is_noexcept< Operation >())
Find a pointer to an item in the container according to a searching criterion.
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
f(args...) is a valid call whose result is usable as a condition.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
std::decay_t< typename HeadC::Item_Type > T
Iterator on elements of a queue.
typename DynList< T >::Iterator Base
Iterator(DynListQueue< T > &q) noexcept
Iterator on the modifiable queue q.
Iterator(const DynListQueue< T > &)=delete
A constant queue is iterated through Const_Iterator.
Generic list of items stored in a container.
bool traverse(Operation &operation) noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_arg< Container, Operation >::type, Container & >())
Traverse the container via its iterator and performs a conditioned operation on each item.
Dynamic doubly linked list implementation.