Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ah-convert.H File Reference

Conversion utilities between Aleph-w and STL container types. More...

#include <deque>
#include <initializer_list>
#include <set>
#include <map>
#include <utility>
#include <tpl_array.H>
#include <tpl_dynArray.H>
#include <tpl_dynDlist.H>
#include <tpl_dynSetTree.H>
#include <tpl_dynSetHash.H>
#include <tpl_dynMapTree.H>
#include <tpl_dynMapOhash.H>
Include dependency graph for ah-convert.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Functions

template<class T >
DynList< TAleph::to_DynList (const Array< T > &a)
 Convert an Array to a DynList.
 
template<class C >
Array< typename C::Item_Type > Aleph::to_Array (const C &c)
 Convert a container to an Array.
 
template<class T >
DynList< TAleph::dynarray_to_DynList (const DynArray< T > &a)
 Convert a DynArray to a DynList.
 
template<class T >
DynArray< TAleph::dynlist_to_DynArray (const DynList< T > &l)
 Convert a DynList to a DynArray.
 
template<class C >
std::vector< typename C::Item_Type > Aleph::to_vector (const C &c)
 Convert a container to a std::vector.
 
template<class T >
DynList< TAleph::vector_to_DynList (const std::vector< T > &v)
 Convert a std::vector to a DynList.
 
template<class T >
Array< TAleph::vector_to_Array (const std::vector< T > &v)
 Convert a std::vector to an Array.
 
template<class T >
DynArray< TAleph::vector_to_DynArray (const std::vector< T > &v)
 Convert a std::vector to a DynArray.
 
template<class C >
DynArray< typename C::Item_Type > Aleph::to_DynArray (const C &c)
 Convert a container to a DynArray.
 
template<class T >
DynArray< TAleph::array_to_DynArray (const Array< T > &a)
 Convert an Array to a DynArray.
 
template<class T >
Array< TAleph::dynarray_to_Array (const DynArray< T > &a)
 Convert a DynArray to an Array.
 
template<class C >
std::deque< typename C::Item_Type > Aleph::to_deque (const C &c)
 Convert a container to a std::deque.
 
template<class T >
DynList< TAleph::deque_to_DynList (const std::deque< T > &d)
 Convert a std::deque to a DynList.
 
template<class T >
Array< TAleph::deque_to_Array (const std::deque< T > &d)
 Convert a std::deque to an Array.
 
template<class T >
DynArray< TAleph::deque_to_DynArray (const std::deque< T > &d)
 Convert a std::deque to a DynArray.
 
template<class T >
DynList< TAleph::dyndlist_to_DynList (const DynDlist< T > &l)
 Convert a DynDlist to a DynList.
 
template<class T >
DynDlist< TAleph::dynlist_to_DynDlist (const DynList< T > &l)
 Convert a DynList to a DynDlist.
 
template<class T >
DynArray< TAleph::dyndlist_to_DynArray (const DynDlist< T > &l)
 Convert a DynDlist to a DynArray.
 
template<class T >
DynDlist< TAleph::dynarray_to_DynDlist (const DynArray< T > &a)
 Convert a DynArray to a DynDlist.
 
template<class T >
DynDlist< TAleph::vector_to_DynDlist (const std::vector< T > &v)
 Convert a std::vector to a DynDlist.
 
template<class T >
DynList< TAleph::vector_to_DynList (std::vector< T > &&v)
 Convert a std::vector to a DynList using move semantics.
 
template<class T >
Array< TAleph::vector_to_Array (std::vector< T > &&v)
 Convert a std::vector to an Array using move semantics.
 
template<class T >
DynArray< TAleph::vector_to_DynArray (std::vector< T > &&v)
 Convert a std::vector to a DynArray using move semantics.
 
template<class T >
DynDlist< TAleph::vector_to_DynDlist (std::vector< T > &&v)
 Convert a std::vector to a DynDlist using move semantics.
 
template<class T , class Compare , class Alloc >
DynList< TAleph::set_to_DynList (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to a DynList.
 
template<class T , class Compare , class Alloc >
Array< TAleph::set_to_Array (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to an Array.
 
template<class T , class Compare , class Alloc >
DynArray< TAleph::set_to_DynArray (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to a DynArray.
 
template<class C >
std::set< typename C::Item_Type > Aleph::to_set (const C &c)
 Convert a container to a std::set.
 
template<class K , class V , class Compare , class Alloc >
DynList< std::pair< K, V > > Aleph::map_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to a DynList of pairs.
 
template<class K , class V , class Compare , class Alloc >
Array< std::pair< K, V > > Aleph::map_to_Array (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to an Array of pairs.
 
template<class K , class V , class Compare , class Alloc >
DynList< K > Aleph::map_keys_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Extract keys from a std::map to a DynList.
 
template<class K , class V , class Compare , class Alloc >
DynList< VAleph::map_values_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Extract values from a std::map to a DynList.
 
template<class T >
DynList< TAleph::init_to_DynList (std::initializer_list< T > il)
 Convert an initializer_list to a DynList.
 
template<class T >
Array< TAleph::init_to_Array (std::initializer_list< T > il)
 Convert an initializer_list to an Array.
 
template<class T >
DynArray< TAleph::init_to_DynArray (std::initializer_list< T > il)
 Convert an initializer_list to a DynArray.
 
template<class T >
DynDlist< TAleph::init_to_DynDlist (std::initializer_list< T > il)
 Convert an initializer_list to a DynDlist.
 
template<typename Key , template< typename, class > class Tree, class Compare >
DynList< Key > Aleph::settree_to_DynList (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a DynList.
 
template<typename Key , template< typename, class > class Tree, class Compare >
Array< Key > Aleph::settree_to_Array (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to an Array.
 
template<typename Key , template< typename, class > class Tree, class Compare >
DynArray< Key > Aleph::settree_to_DynArray (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a DynArray.
 
template<typename Key , template< typename, class > class Tree, class Compare >
std::vector< Key > Aleph::settree_to_vector (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a std::vector.
 
template<typename Key , template< typename, class > class Tree, class Compare >
std::set< Key > Aleph::settree_to_stdset (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a std::set.
 
template<class C >
DynSetTree< typename C::Item_Type > Aleph::to_DynSetTree (const C &c)
 Convert a container to a DynSetTree (AVL by default).
 
template<class T >
DynSetTree< TAleph::vector_to_DynSetTree (const std::vector< T > &v)
 Convert a std::vector to a DynSetTree.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
DynList< Key > Aleph::sethash_to_DynList (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a DynList.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
Array< Key > Aleph::sethash_to_Array (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to an Array.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
DynArray< Key > Aleph::sethash_to_DynArray (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a DynArray.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
std::vector< Key > Aleph::sethash_to_vector (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a std::vector.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< std::pair< Key, Data > > Aleph::maptree_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to a DynList of pairs.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
Array< std::pair< Key, Data > > Aleph::maptree_to_Array (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to an Array of pairs.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
std::map< Key, DataAleph::maptree_to_stdmap (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to a std::map.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< Key > Aleph::maptree_keys_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Extract keys from a DynMapTree to a DynList.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< DataAleph::maptree_values_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Extract values from a DynMapTree to a DynList.
 
template<class K , class V , class Compare , class Alloc >
DynMapTree< K, VAleph::stdmap_to_DynMapTree (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to a DynMapTree.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< std::pair< Key, Data > > Aleph::maphash_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to a DynList of pairs.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
Array< std::pair< Key, Data > > Aleph::maphash_to_Array (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to an Array of pairs.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
std::map< Key, DataAleph::maphash_to_stdmap (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to a std::map.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< Key > Aleph::maphash_keys_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Extract keys from a MapOpenHash to a DynList.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< DataAleph::maphash_values_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Extract values from a MapOpenHash to a DynList.
 

Detailed Description

Conversion utilities between Aleph-w and STL container types.

Provides template functions for converting between different container types including Aleph-w containers (Array, DynList, DynArray, DynDlist) and STL containers (std::vector, std::deque, std::set, std::map).

Key Features

  • Copy conversions: All functions create copies of elements
  • Move conversions: vector_to_* overloads accept rvalue references
  • Set/Map support: Convert to/from std::set and std::map
  • initializer_list: Create containers from brace-init lists

Available Conversions

Generic Conversions (from any Aleph container)

Function To
to_Array Array
to_DynArray DynArray
to_vector std::vector
to_deque std::deque
to_set std::set

From std::vector (copy and move)

Function To
vector_to_DynList DynList
vector_to_Array Array
vector_to_DynArray DynArray
vector_to_DynDlist DynDlist

From std::set

Function To
set_to_DynList DynList
set_to_Array Array
set_to_DynArray DynArray

From std::map

Function To
map_to_DynList DynList<pair>
map_to_Array Array<pair>
map_keys_to_DynList DynList (keys only)
map_values_to_DynList DynList (values only)

From initializer_list

Function To
init_to_DynList DynList
init_to_Array Array
init_to_DynArray DynArray
init_to_DynDlist DynDlist

Usage Examples

```cpp From Aleph to STL DynList<int> list = {1, 2, 3}; auto vec = to_vector(list); auto s = to_set(list);

From STL to Aleph (copy) std::vector<int> v = {4, 5, 6}; auto arr = vector_to_Array(v);

From STL to Aleph (move - efficient for large data) auto dynList = vector_to_DynList(std::move(v));

From initializer_list auto arr2 = init_to_Array({1, 2, 3, 4, 5});

From std::map std::map<std::string, int> m = {{"a", 1}, {"b", 2}}; auto keys = map_keys_to_DynList(m); ```

Author
Leandro Rabindranath León

Definition in file ah-convert.H.