120#include <initializer_list>
150 return a.template maps<T>([] (
const auto & item) ->
const T & {
return item; });
172 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
173 ret.
append(it.get_curr());
201 for (
size_t i = 0; i < a.
size(); ++i)
221 for (
auto it =
l.
get_it(); it.has_curr(); it.next_ne())
222 ret.
append(it.get_curr());
244 for (
const auto & item : v)
268 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
269 ret.
append(it.get_curr());
288 for (
size_t i = 0; i < a.
size(); ++i)
308 for (
size_t i = 0; i < a.
size(); ++i)
326[[nodiscard]] std::deque<typename C::Item_Type>
to_deque(
const C & c)
328 std::deque<typename C::Item_Type> ret;
329 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
330 ret.push_back(it.get_curr());
349 for (
const auto & item : d)
370 for (
const auto & item : d)
390 for (
const auto & item : d)
469 for (
size_t i = 0; i < a.
size(); ++i)
489 for (
const auto & item : v)
512 for (
auto & item : v)
513 ret.
append(std::move(item));
533 for (
auto & item : v)
534 ret.
append(std::move(item));
554 for (
auto & item : v)
555 ret.
append(std::move(item));
575 for (
auto & item : v)
576 ret.
append(std::move(item));
595template <
class T,
class Compare,
class Alloc>
599 for (
const auto & item : s)
617template <
class T,
class Compare,
class Alloc>
622 for (
const auto & item : s)
640template <
class T,
class Compare,
class Alloc>
644 for (
const auto & item : s)
661[[nodiscard]] std::set<typename C::Item_Type>
to_set(
const C & c)
663 std::set<typename C::Item_Type> ret;
664 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
665 ret.
insert(it.get_curr());
685template <
class K,
class V,
class Compare,
class Alloc>
690 for (
const auto & [key,
value] :
m)
709template <
class K,
class V,
class Compare,
class Alloc>
715 for (
const auto & [key,
value] :
m)
734template <
class K,
class V,
class Compare,
class Alloc>
738 for (
const auto & [key,
value] :
m)
757template <
class K,
class V,
class Compare,
class Alloc>
761 for (
const auto & [key,
value] :
m)
788 for (
const auto & item : il)
813 for (
const auto & item : il)
838 for (
const auto & item : il)
863 for (
const auto & item : il)
883template <
typename Key,
template <
typename,
class>
class Tree,
class Compare>
904template <
typename Key,
template <
typename,
class>
class Tree,
class Compare>
926template <
typename Key,
template <
typename,
class>
class Tree,
class Compare>
944template <
typename Key,
template <
typename,
class>
class Tree,
class Compare>
947 std::vector<Key> ret;
949 s.
for_each([&ret](
const Key & item) { ret.push_back(item); });
963template <
typename Key,
template <
typename,
class>
class Tree,
class Compare>
967 s.
for_each([&ret](
const Key & item) { ret.insert(item); });
986 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
987 ret.
insert(it.get_curr());
1003 for (
const auto & item : v)
1020template <
typename Key,
template <
typename,
class>
class HashTable,
class Cmp>
1038template <
typename Key,
template <
typename,
class>
class HashTable,
class Cmp>
1057template <
typename Key,
template <
typename,
class>
class HashTable,
class Cmp>
1075template <
typename Key,
template <
typename,
class>
class HashTable,
class Cmp>
1078 std::vector<Key> ret;
1079 ret.reserve(s.size());
1080 s.
for_each([&ret](
const Key & item) { ret.push_back(item); });
1100template <
typename Key,
typename Data,
1101 template <
typename,
class>
class Tree,
class Compare>
1106 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p); });
1121template <
typename Key,
typename Data,
1122 template <
typename,
class>
class Tree,
class Compare>
1128 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p); });
1143template <
typename Key,
typename Data,
1144 template <
typename,
class>
class Tree,
class Compare>
1145[[nodiscard]] std::map<Key, Data>
1148 std::map<Key, Data> ret;
1149 m.
for_each([&ret](
const std::pair<Key, Data> & p) {
1150 ret.emplace(p.first, p.second);
1166template <
typename Key,
typename Data,
1167 template <
typename,
class>
class Tree,
class Compare>
1172 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p.first); });
1187template <
typename Key,
typename Data,
1188 template <
typename,
class>
class Tree,
class Compare>
1193 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p.second); });
1208template <
class K,
class V,
class Compare,
class Alloc>
1213 for (
const auto & [key,
value] :
m)
1231template <
typename Key,
typename Data,
class Cmp,
1232 template <
typename,
class>
class HashTable>
1237 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p); });
1252template <
typename Key,
typename Data,
class Cmp,
1253 template <
typename,
class>
class HashTable>
1259 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p); });
1274template <
typename Key,
typename Data,
class Cmp,
1275 template <
typename,
class>
class HashTable>
1276[[nodiscard]] std::map<Key, Data>
1279 std::map<Key, Data> ret;
1280 m.
for_each([&ret](
const std::pair<Key, Data> & p) {
1281 ret.emplace(p.first, p.second);
1297template <
typename Key,
typename Data,
class Cmp,
1298 template <
typename,
class>
class HashTable>
1303 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p.first); });
1318template <
typename Key,
typename Data,
class Cmp,
1319 template <
typename,
class>
class HashTable>
1324 m.
for_each([&ret](
const std::pair<Key, Data> & p) { ret.
append(p.second); });
Conversions between std::vector and Aleph-w containers shared by ah-convert.H and ah-stl-utils....
size_t size_t int32_t value
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
void reserve(size_t cap)
Reserves cap cells into the array.
T & insert(const T &item)
Insert a copy of item at the beginning of the array.
size_t size() const noexcept
Return the current dimension of array.
T & append()
Allocate a new entry to the end of array.
void reserve(const size_t l, const size_t r)
Allocate a range of entries.
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.
Self-adjusting dynamic hash table.
Doubly-linked list (defined in tpl_dynList.H).
T & append(const T &item)
Generic key-value map implemented on top of a binary search tree.
Pair * insert(const Key &key, const Data &data)
Insert a key-value pair.
Dynamic set backed by balanced binary search trees with automatic memory management.
const size_t & size() const
Returns the cardinality of the set.
Key * insert(const Key &key)
Inserts a key into the dynamic set.
void for_each(Operation &operation) const
Traverse all the container and performs an operation on each element.
auto get_it()
Return a properly initialized iterator positioned at the first item on the container.
constexpr size_t size() const noexcept
Returns the number of entries in the table.
Concept that identifies types that can be converted or used as an Aleph Array.
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).
DynSetTree< T > vector_to_DynSetTree(const std::vector< T > &v)
Convert a std::vector to a DynSetTree.
std::set< Key > settree_to_stdset(const DynSetTree< Key, Tree, Compare > &s)
Convert a DynSetTree to a std::set.
DynList< T > to_DynList(const Array< T > &a)
Convert an Array to a DynList.
DynList< K > map_keys_to_DynList(const std::map< K, V, Compare, Alloc > &m)
Extract keys from a std::map to a DynList.
DynList< V > map_values_to_DynList(const std::map< K, V, Compare, Alloc > &m)
Extract values from a std::map to a DynList.
DynList< std::pair< K, V > > map_to_DynList(const std::map< K, V, Compare, Alloc > &m)
Convert a std::map to a DynList of pairs.
DynList< T > dyndlist_to_DynList(const DynDlist< T > &l)
Convert a DynDlist to a DynList.
DynList< T > dynarray_to_DynList(const DynArray< T > &a)
Convert a DynArray to a DynList.
DynList< Key > maptree_keys_to_DynList(const DynMapTree< Key, Data, Tree, Compare > &m)
Extract keys from a DynMapTree to a DynList.
DynArray< T > dyndlist_to_DynArray(const DynDlist< T > &l)
Convert a DynDlist to a DynArray.
Array< std::pair< Key, Data > > maphash_to_Array(const MapOpenHash< Key, Data, Cmp, HashTable > &m)
Convert a MapOpenHash to an Array of pairs.
DynList< std::pair< Key, Data > > maphash_to_DynList(const MapOpenHash< Key, Data, Cmp, HashTable > &m)
Convert a MapOpenHash to a DynList of pairs.
Array< std::pair< Key, Data > > maptree_to_Array(const DynMapTree< Key, Data, Tree, Compare > &m)
Convert a DynMapTree to an Array of pairs.
DynDlist< T > vector_to_DynDlist(const std::vector< T > &v)
Convert a std::vector to a DynDlist.
Array< T > deque_to_Array(const std::deque< T > &d)
Convert a std::deque to an Array.
Array< T > init_to_Array(std::initializer_list< T > il)
Convert an initializer_list to an Array.
std::vector< Key > sethash_to_vector(const DynHashTable< Key, HashTable, Cmp > &s)
Convert a DynHashTable (hash set) to a std::vector.
DynList< std::pair< Key, Data > > maptree_to_DynList(const DynMapTree< Key, Data, Tree, Compare > &m)
Convert a DynMapTree to a DynList of pairs.
std::decay_t< typename HeadC::Item_Type > T
Array< T > dynarray_to_Array(const DynArray< T > &a)
Convert a DynArray to an Array.
DynList< Data > maptree_values_to_DynList(const DynMapTree< Key, Data, Tree, Compare > &m)
Extract values from a DynMapTree to a DynList.
DynArray< Key > settree_to_DynArray(const DynSetTree< Key, Tree, Compare > &s)
Convert a DynSetTree to a DynArray.
std::map< Key, Data > maphash_to_stdmap(const MapOpenHash< Key, Data, Cmp, HashTable > &m)
Convert a MapOpenHash to a std::map.
Array< T > set_to_Array(const std::set< T, Compare, Alloc > &s)
Convert a std::set to an Array.
DynList< T > vector_to_DynList(const std::vector< T > &v)
Convert a std::vector to a DynList.
DynArray< T > dynlist_to_DynArray(const DynList< T > &l)
Convert a DynList to a DynArray.
DynArray< T > array_to_DynArray(const Array< T > &a)
Convert an Array to a DynArray.
DynSetTree< typename C::Item_Type > to_DynSetTree(const C &c)
Convert a container to a DynSetTree (AVL by default).
@ Tree
Basic arc (in spanning tree).
DynArray< T > deque_to_DynArray(const std::deque< T > &d)
Convert a std::deque to a DynArray.
std::vector< Key > settree_to_vector(const DynSetTree< Key, Tree, Compare > &s)
Convert a DynSetTree to a std::vector.
std::set< typename C::Item_Type > to_set(const C &c)
Convert a container to a std::set.
Array< T > vector_to_Array(const std::vector< T > &v)
Convert a std::vector to an Array.
DynList< Key > sethash_to_DynList(const DynHashTable< Key, HashTable, Cmp > &s)
Convert a DynHashTable (hash set) to a DynList.
DynDlist< T > dynlist_to_DynDlist(const DynList< T > &l)
Convert a DynList to a DynDlist.
Array< Key > sethash_to_Array(const DynHashTable< Key, HashTable, Cmp > &s)
Convert a DynHashTable (hash set) to an Array.
DynDlist< T > init_to_DynDlist(std::initializer_list< T > il)
Convert an initializer_list to a DynDlist.
DynList< Data > maphash_values_to_DynList(const MapOpenHash< Key, Data, Cmp, HashTable > &m)
Extract values from a MapOpenHash to a DynList.
DynList< Key > settree_to_DynList(const DynSetTree< Key, Tree, Compare > &s)
Convert a DynSetTree to a DynList.
std::map< Key, Data > maptree_to_stdmap(const DynMapTree< Key, Data, Tree, Compare > &m)
Convert a DynMapTree to a std::map.
DynArray< T > vector_to_DynArray(const std::vector< T > &v)
Convert a std::vector to a DynArray.
DynList< T > deque_to_DynList(const std::deque< T > &d)
Convert a std::deque to a DynList.
Array< std::pair< K, V > > map_to_Array(const std::map< K, V, Compare, Alloc > &m)
Convert a std::map to an Array of pairs.
DynList< Key > maphash_keys_to_DynList(const MapOpenHash< Key, Data, Cmp, HashTable > &m)
Extract keys from a MapOpenHash to a DynList.
DynList< T > set_to_DynList(const std::set< T, Compare, Alloc > &s)
Convert a std::set to a DynList.
Array< typename C::Item_Type > to_Array(const C &c)
Convert a container to an Array.
DynMapTree< K, V > stdmap_to_DynMapTree(const std::map< K, V, Compare, Alloc > &m)
Convert a std::map to a DynMapTree.
DynArray< T > set_to_DynArray(const std::set< T, Compare, Alloc > &s)
Convert a std::set to a DynArray.
Array< Key > settree_to_Array(const DynSetTree< Key, Tree, Compare > &s)
Convert a DynSetTree to an Array.
DynArray< Key > sethash_to_DynArray(const DynHashTable< Key, HashTable, Cmp > &s)
Convert a DynHashTable (hash set) to a DynArray.
std::deque< typename C::Item_Type > to_deque(const C &c)
Convert a container to a std::deque.
DynArray< typename C::Item_Type > to_DynArray(const C &c)
Convert a container to a DynArray.
DynDlist< T > dynarray_to_DynDlist(const DynArray< T > &a)
Convert a DynArray to a DynDlist.
DynList< T > init_to_DynList(std::initializer_list< T > il)
Convert an initializer_list to a DynList.
DynArray< T > init_to_DynArray(std::initializer_list< T > il)
Convert an initializer_list to a DynArray.
Open addressing hash map for key-value pairs.
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
Dynamic array container with automatic resizing.
Lazy and scalable dynamic array implementation.
Dynamic doubly linked list implementation.
Dynamic map with open hashing.
Dynamic key-value map based on balanced binary search trees.
Dynamic set implementations based on hash tables.
Dynamic set implementations based on balanced binary search trees.