38# include <gtest/gtest.h>
44using namespace testing;
54 for (
size_t i = 0; i < 25; ++i, ++
n)
228 for (
auto it = list.get_it(); it.has_curr(); it.next(), ++i)
249 for (
auto it =
l.
get_it(); it.has_curr(); it.next(), ++i)
252 for (
auto it =
r.get_it(); it.has_curr(); it.next(), ++i)
258 for (
auto it =
l.
get_it(); it.has_curr(); it.next(), ++i)
272 for (
auto it =
laux.get_it(); it.has_curr(); it.next(), ++i)
280 for (
auto it = list.get_it(); it.has_curr(); it.next(), --i)
286 for (
auto it = list.get_it(); it.has_curr(); it.next(), ++i)
308 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
317 auto it = list.get_it();
318 for (
int i = 0, n = 4; i < 3; ++i, ++n, it.next())
322 list.rotate_left(22);
324 for (
auto it = list.get_it(); it.has_curr(); it.next(), ++i)
336 list.append(std::move(
lg));
342 for (
auto it = list.get_it(); it.has_curr(); it.next(), ++i)
350 auto ret =
m.
traverse([&n] (
int) { ++n;
return true; });
360 auto ret = list.traverse([&
N,
this] (
int i) { ++
N;
return i < n/2; });
385 for (
int v : {5, 8, 13})
392 for (
auto it = list.
get_it(); it.has_curr(); it.next(), ++i)
Conversion utilities between Aleph-w and STL container types.
Deduplicate sequential Aleph containers in-place.
Dynamic singly linked list with functional programming support.
T & insert(const T &item)
T & append(const T &item)
T & get_last() const
Return the last item of the list.
T & get_first() const
Return the first item of the list.
void clear() noexcept
Empties the container.
DynList & reverse() noexcept
DynList & swap(DynList &l) noexcept
bool has_curr() const noexcept
constexpr bool is_empty() const noexcept
void rotate_left(size_t n)
Rotate to left the list n positions.
size_t split(HTList &l, HTList &r) noexcept
size_t size() const noexcept
Count the number of elements of the list.
bool is_unitarian() const noexcept
Return true if the list contains exactly just one.
bool is_unitarian_or_empty() const noexcept
Return true if list contains one element or is empty.
bool contains(const Type &item) const
Test if an item is present in the container using equality.
auto get_it() const
Return a properly initialized iterator positioned at the first item on the container.
TEST_F(List_of_25_items, Basic_operations)
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
Array< typename C::Item_Type > to_array(const C &c)
Convenience wrapper identical to to_Array (copy contents).
void in_place_unique(Container &c, Compare cmp={})
Remove duplicates in-place preserving first occurrence order.
void reverse(Itor beg, Itor end)
Reverse elements in a range.
bool eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Check equality of two containers using a predicate.
T & swap(T &t1, T &t2)
Generic swap using object's swap method.
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.
void rotate_left(T *ptr, const size_t n, size_t m) noexcept
Rotate array elements left by m positions.
bool traverse(Operation &operation) noexcept(traverse_is_noexcept< Operation >())
Traverse the container via its iterator and performs a conditioned operation on each item.
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)