|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Example demonstrating STL <-> Aleph-w container conversions. More...
#include <iostream>#include <iomanip>#include <string>#include <vector>#include <list>#include <set>#include <algorithm>#include <numeric>#include <ah-stl-utils.H>#include <htlist.H>#include <tpl_dynArray.H>Go to the source code of this file.
Functions | |
| void | print_header (const string &title) |
| void | print_subheader (const string &subtitle) |
| template<typename Container > | |
| void | print_stl_container (const string &name, const Container &c) |
| template<typename T > | |
| void | print_dynlist (const string &name, const DynList< T > &l) |
| template<typename T > | |
| void | print_dynarray (const string &name, const DynArray< T > &arr) |
| void | demo_vector_dynlist () |
| void | demo_vector_dynarray () |
| void | demo_list_dynlist () |
| void | demo_range_conversions () |
| void | demo_tuple_conversions () |
| void | demo_variadic_packing () |
| void | demo_map_transformations () |
| void | demo_integration () |
| int | main () |
Example demonstrating STL <-> Aleph-w container conversions.
This example demonstrates seamless interoperability between Standard Template Library (STL) containers and Aleph-w containers using ah-stl-utils.H. This is essential for integrating Aleph-w with existing STL-based codebases and third-party libraries.
Many C++ projects use STL containers (std::vector, std::list, etc.), while Aleph-w provides its own container types (DynList, DynArray, etc.). This utility bridge allows you to:
std::vector<T> → DynList<T> / DynArray<T>std::list<T> → DynList<T>std::set<T> → DynSetTree<T>DynList<T> → std::vector<T> / std::list<T>DynArray<T> → std::vector<T>std::map and Aleph map typesMost conversions are O(n) where n is container size:
Best practice: Minimize conversions, convert once at boundaries.
This example has no command-line options; it runs all demos.
Definition in file stl_utils_example.C.
| void demo_integration | ( | ) |
Definition at line 502 of file stl_utils_example.C.
References FunctionalMethods< Container, T >::filter(), FunctionalMethods< Container, T >::foldl(), Aleph::maps(), print_header(), Aleph::HTList::size(), Aleph::to_DynList(), and Aleph::to_vector().
Referenced by main().
| void demo_list_dynlist | ( | ) |
Definition at line 301 of file stl_utils_example.C.
References Aleph::DynList< T >::append(), Aleph::DynList_to_list(), Aleph::list_to_DynList(), Aleph::maps(), print_dynlist(), print_header(), print_stl_container(), print_subheader(), and Aleph::stl_container_to_dynList().
Referenced by main().
| void demo_map_transformations | ( | ) |
Definition at line 458 of file stl_utils_example.C.
References Aleph::map_vector(), Aleph::maps(), print_dynlist(), print_header(), print_stl_container(), print_subheader(), Aleph::to_DynList(), and Aleph::to_string().
Referenced by main().
| void demo_range_conversions | ( | ) |
Definition at line 338 of file stl_utils_example.C.
References StlAlephIterator< SetName >::begin(), StlAlephIterator< SetName >::end(), Aleph::maps(), print_dynlist(), print_header(), print_stl_container(), print_subheader(), and Aleph::range_to_DynList().
Referenced by main().
| void demo_tuple_conversions | ( | ) |
Definition at line 372 of file stl_utils_example.C.
References LocateFunctions< Container, Type >::get_it(), Aleph::maps(), print_dynlist(), print_header(), print_subheader(), Aleph::HTList::size(), Aleph::tuple_for_each(), Aleph::tuple_to_array(), and Aleph::tuple_to_dynlist().
Referenced by main().
| void demo_variadic_packing | ( | ) |
Definition at line 421 of file stl_utils_example.C.
References LocateFunctions< Container, Type >::get_it(), Aleph::maps(), print_dynlist(), print_header(), print_stl_container(), and print_subheader().
Referenced by main().
| void demo_vector_dynarray | ( | ) |
Definition at line 266 of file stl_utils_example.C.
References Aleph::accumulate(), Aleph::DynList< T >::append(), StlAlephIterator< SetName >::begin(), Aleph::DynArray_to_vector(), StlAlephIterator< SetName >::end(), Aleph::maps(), print_dynarray(), print_header(), print_stl_container(), print_subheader(), Aleph::HTList::size(), and Aleph::vector_to_DynArray().
Referenced by main().
| void demo_vector_dynlist | ( | ) |
Definition at line 218 of file stl_utils_example.C.
References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::foldl(), Aleph::maps(), print_dynlist(), print_header(), print_stl_container(), print_subheader(), Aleph::to_DynList(), Aleph::to_vector(), and Aleph::vector_to_DynList().
Referenced by main().
| int main | ( | ) |
Definition at line 568 of file stl_utils_example.C.
References demo_integration(), demo_list_dynlist(), demo_map_transformations(), demo_range_conversions(), demo_tuple_conversions(), demo_variadic_packing(), demo_vector_dynarray(), demo_vector_dynlist(), and Aleph::maps().
Definition at line 206 of file stl_utils_example.C.
References Aleph::maps(), and Aleph::DynArray< T >::size().
Referenced by demo_vector_dynarray().
Definition at line 197 of file stl_utils_example.C.
References LocateFunctions< Container, Type >::get_it(), l, Aleph::maps(), and Aleph::HTList::size().
Referenced by demo_list_dynlist(), demo_map_transformations(), demo_range_conversions(), demo_tuple_conversions(), demo_variadic_packing(), and demo_vector_dynlist().
| void print_header | ( | const string & | title | ) |
Definition at line 173 of file stl_utils_example.C.
References Aleph::maps().
Definition at line 188 of file stl_utils_example.C.
References Aleph::maps().
Referenced by demo_list_dynlist(), demo_map_transformations(), demo_range_conversions(), demo_variadic_packing(), demo_vector_dynarray(), and demo_vector_dynlist().
| void print_subheader | ( | const string & | subtitle | ) |
Definition at line 181 of file stl_utils_example.C.
References FunctionalMethods< Container, T >::length(), and Aleph::maps().
Referenced by demo_list_dynlist(), demo_map_transformations(), demo_range_conversions(), demo_tuple_conversions(), demo_variadic_packing(), demo_vector_dynarray(), and demo_vector_dynlist().