38#include <gtest/gtest.h>
76 static_assert(std::forward_iterator<Iter>);
77 static_assert(std::forward_iterator<CIter>);
79 static_assert(std::same_as<std::iter_reference_t<Iter>, std::iter_reference_t<const Iter>>);
80 static_assert(std::same_as<std::iter_reference_t<CIter>, std::iter_reference_t<const CIter>>);
88 using Iter = Set::iterator;
89 using CIter = Set::const_iterator;
91 static_assert(std::forward_iterator<Iter>);
92 static_assert(std::forward_iterator<CIter>);
94 static_assert(std::same_as<std::iter_reference_t<Iter>, std::iter_reference_t<const Iter>>);
95 static_assert(std::same_as<std::iter_reference_t<CIter>, std::iter_reference_t<const CIter>>);
97 using Ref = std::iter_reference_t<Iter>;
98 using Ptr = std::add_pointer_t<std::remove_reference_t<Ref>>;
99 static_assert(std::same_as<decltype(std::declval<const Iter &>().operator->()),
Ptr>,
100 "operator-> must return a pointer consistent with operator*");
132 for (
int i = 1; i <= 5; ++i)
145 for (
const int & x :
clist)
157 auto it = list.
begin();
173 EXPECT_TRUE(std::ranges::all_of(set, [](
int x) {
return x > 0; }));
175 auto it = std::ranges::find(set, 5);
179 auto min_it = std::ranges::min_element(set);
200 auto it = list.
begin();
211 static_assert(std::random_access_iterator<Iter>);
212 static_assert(std::same_as<
213 typename std::iterator_traits<Iter>::iterator_category,
214 std::random_access_iterator_tag>);
223 static_assert(std::random_access_iterator<Iter>);
230 static_assert(std::random_access_iterator<DynArray<int>::const_iterator>);
231 static_assert(std::random_access_iterator<Array<int>::const_iterator>);
234 static_assert(std::forward_iterator<DynDlist<int>::const_iterator>);
235 static_assert(
not std::random_access_iterator<DynDlist<int>::const_iterator>);
247 static_assert(std::forward_iterator<Iter>);
248 static_assert(
not std::random_access_iterator<Iter>);
256 for (
int i = 0; i < 10; ++i)
259 auto first = a.
begin();
288 for (
int v : {5, 2, 8, 1, 9, 3, 7, 4, 6, 0})
300 std::ranges::sort(a, std::ranges::greater{});
311 for (
int v : {3, 1, 2, 5, 4})
341 for (
int i = 0; i < 10; ++i)
364 auto lb = std::lower_bound(
ca.begin(),
ca.end(), 7);
369 for (
int v : {1, 2, 3})
404 int buf[5] = {20, 30, 999, 0, 10};
422 EXPECT_EQ(it.get_pos(), at_end.get_pos());
430 GTEST_SKIP() <<
"C++20 concepts not fully supported on this platform";
C++20 Ranges support and adaptors for Aleph-w containers.
Iterator wrapper for C++ raw arrays and circular buffers.
Iterator wrapper for C++ raw arrays.
Simple dynamic array with automatic resizing and functional operations.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
T & append(const T &data)
Append a copy of data
Dynamic heap (priority queue) backed by DynArray.
T & append()
Allocate a new entry to the end of array.
Dynamic doubly linked list with O(1) size and bidirectional access.
T & append(const T &item)
Append a copied item at the end of the list.
Dynamic set backed by balanced binary search trees with automatic memory management.
Key * insert(const Key &key)
Inserts a key into the dynamic set.
iterator end() noexcept
Return an STL-compatible end iterator.
iterator begin() noexcept
Return an STL-compatible iterator to the first element.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Dynamic array container with automatic resizing.
Array-based dynamic binary heap.
Lazy and scalable dynamic array implementation.
Dynamic doubly linked list implementation.
Dynamic set implementations based on balanced binary search trees.