38# include <gtest/gtest.h>
44using namespace testing;
47constexpr size_t N = 17;
55 for (
size_t i = 0; i <
N; ++i, ++
n)
66 for (
size_t i = 0; i <
N; ++i, ++
n)
67 q.put({ int(i), 0, 1, 2, int(i) });
88 for (
size_t i = 0; i < m; ++i)
92 for (
size_t i = 0; i < n; ++i)
99 for (
size_t i = 0; i < m; ++i)
105 for (
size_t i = 0; i < m; ++i)
121 const size_t m = 100;
122 for (
size_t i = 0; i < m; ++i)
124 ASSERT_EQ(q.put({int(i), 0, 1, int(i)}).get_first(), i);
132 for (
size_t i = 0; i < n; ++i)
147 for (
size_t i = 0; i < m; ++i)
158 for (
size_t i = 0; i < m; ++i)
184 auto it = q.get_it();
185 for (
size_t i = 0; it.has_curr(); it.next(), ++i)
191 auto it = q.get_it();
192 for (
size_t i = 0; it.has_curr(); it.next(), ++i)
286 for (
auto it =
qc.
get_it(); it.has_curr(); it.next(), ++
k)
288 auto &
l = it.get_curr();
306 for (
auto it =
qc.
get_it(); it.has_curr(); it.next(), ++
k)
308 auto &
l = it.get_curr();
Functional programming utilities for Aleph-w containers.
T & put(const T &item)
Copy and put an item in the queue.
Dynamic queue of elements of generic type T based on single linked list.
constexpr size_t size() const noexcept
Return the number of elements.
T & front()
Return a modifiable reference to the oldest item in the queue.
T & rear()
Return a modifiable reference to the youngest item in the queue.
bool is_empty() const noexcept
Return true if this is empty.
Dynamic singly linked list with functional programming support.
T & get_last() const
Return the last item of the list.
T & get_first() const
Return the first item of the list.
constexpr bool is_empty() const noexcept
Return true if list is empty.
size_t size() const noexcept
Count the number of elements of the list.
Type & nth(const size_t n)
Return the n-th item of container.
auto get_it() const
Return a properly initialized iterator positioned at the first item on the container.
TEST_F(SimpleQueue, get_put)
Main namespace for Aleph-w library functions.
bool eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Check equality of two containers using a predicate.
bool traverse(Node *root, Op op)
DynList< T > maps(const C &c, Op op)
Classic map operation.
ArrayQueue< DynList< int > > q
DynListQueue< DynList< int > > q
bool traverse(Operation &operation) noexcept(traverse_is_noexcept< Operation >())
Traverse the container via its iterator and performs a conditioned operation on each item.
Dynamic queue implementation based on linked lists.