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();
324 bool ret = q.traverse([&i] (
int k) {
return (
k == i++); });
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.
Type & nth(const size_t n)
Return the n-th item of the 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.
and
Check uniqueness with explicit hash + equality functors.
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)
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
ArrayQueue< DynList< int > > q
DynListQueue< DynList< int > > q
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
Dynamic queue implementation based on linked lists.