|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lazy zip iterators and functional operations for STL containers. More...
#include <type_traits>#include <tuple>#include <iterator>#include <utility>#include <optional>#include <functional>Go to the source code of this file.
Classes | |
| class | Aleph::StlZipIterator< Containers > |
| Lazy iterator that traverses multiple STL containers in lockstep. More... | |
| struct | Aleph::StlZipIterator< Containers >::end_tag |
| Construct end iterator (all at end). More... | |
| class | Aleph::StlZipView< Containers > |
| Lazy view over multiple zipped STL containers. More... | |
| class | Aleph::StlEnumerateIterator< Container > |
| Iterator that pairs each element with its index. More... | |
| struct | Aleph::StlEnumerateIterator< Container >::end_tag |
| class | Aleph::StlEnumerateView< Container > |
| Lazy view that pairs each element with its index. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::stl_zip_detail |
Typedefs | |
| template<typename IterPair > | |
| using | Aleph::stl_zip_detail::iter_value_t = std::decay_t< decltype(*std::get< 0 >(std::declval< IterPair >()))> |
Functions | |
| template<typename... IterPairs> | |
| constexpr bool | Aleph::stl_zip_detail::all_valid (const IterPairs &... its) noexcept |
| template<typename... IterPairs> | |
| constexpr void | Aleph::stl_zip_detail::advance_all (IterPairs &... its) noexcept |
| template<typename... IterPairs> | |
| constexpr auto | Aleph::stl_zip_detail::deref_all (const IterPairs &... its) |
| template<typename... Containers> | |
| constexpr auto | Aleph::stl_zip (const Containers &... cs) |
| Create a lazy zip view over STL containers. | |
| template<typename... Containers> | |
| constexpr auto | Aleph::stl_zip_it (const Containers &... cs) |
| Get a zip iterator over STL containers. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_all (Pred &&pred, const Containers &... cs) |
| Check if predicate holds for all zipped tuples. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_all_eq (Pred &&pred, const Containers &... cs) |
| Check if predicate holds for all tuples AND containers have equal length. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_exists (Pred &&pred, const Containers &... cs) |
| Check if predicate holds for any zipped tuple. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_any (Pred &&pred, const Containers &... cs) |
| Alias for stl_zip_exists (Python/JS style name) | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_none (Pred &&pred, const Containers &... cs) |
| Check if no tuple satisfies the predicate. | |
| template<typename Op , typename... Containers> | |
| void | Aleph::stl_zip_for_each (Op &&op, const Containers &... cs) |
| Apply operation to each zipped tuple (for side effects). | |
| template<typename Op , typename... Containers> | |
| void | Aleph::stl_zip_for_each_indexed (Op &&op, const Containers &... cs) |
| Apply operation to each tuple with its index. | |
| template<typename T , typename Op , typename... Containers> | |
| T | Aleph::stl_zip_foldl (T init, Op &&op, const Containers &... cs) |
| Left fold over zipped tuples. | |
| template<typename T , typename Op , typename... Containers> | |
| T | Aleph::stl_zip_reduce (T init, Op &&op, const Containers &... cs) |
| Alias for stl_zip_foldl (alternative name) | |
| template<typename Op , typename... Containers> | |
| auto | Aleph::stl_zip_map (Op &&op, const Containers &... cs) |
| Map operation over zipped tuples, returning a vector. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_filter (Pred &&pred, const Containers &... cs) |
| Filter zipped tuples by predicate. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_find_first (Pred &&pred, const Containers &... cs) |
| Find first tuple satisfying predicate. | |
| template<typename Pred , typename... Containers> | |
| size_t | Aleph::stl_zip_count (Pred &&pred, const Containers &... cs) |
| Count tuples satisfying predicate. | |
| template<typename... Containers> | |
| size_t | Aleph::stl_zip_length (const Containers &... cs) |
| Count total tuples (minimum length of containers). | |
| template<typename... Containers> | |
| bool | Aleph::stl_zip_equal_length (const Containers &... cs) |
| Check if all containers have equal length. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_nth (const size_t n, const Containers &... cs) |
| Get n-th tuple from zipped containers. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_take (const size_t n, const Containers &... cs) |
| Take first n tuples from zipped containers. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_drop (const size_t n, const Containers &... cs) |
| Skip first n tuples, return the rest. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_partition (Pred &&pred, const Containers &... cs) |
| Partition tuples by predicate. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_to_vector (const Containers &... cs) |
| Materialize zipped tuples into a vector. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_traverse (Pred &&pred, const Containers &... cs) |
| Traverse while predicate returns true. | |
| template<typename Pred , typename... Containers> | |
| bool | Aleph::stl_zip_traverse_eq (Pred &&pred, const Containers &... cs) |
| Traverse while predicate returns true, verify equal lengths. | |
| template<typename Cmp , typename Tuple , size_t... Is> | |
| bool | Aleph::stl_zip_detail::compare_adjacent_impl (Cmp &cmp, const Tuple &t, std::index_sequence< Is... >) |
| template<typename Cmp , typename... Containers> | |
| bool | Aleph::stl_zip_cmp (Cmp &&cmp, const Containers &... cs) |
| Compare elements across containers using a comparator. | |
| template<typename Container > | |
| constexpr auto | Aleph::stl_enumerate (const Container &c) |
| Create an enumerate view over a container. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_take_while (Pred &&pred, const Containers &... cs) |
| Take tuples while predicate returns true. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_drop_while (Pred &&pred, const Containers &... cs) |
| Skip tuples while predicate returns true, then return the rest. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_first (const Containers &... cs) |
| Get first tuple from zipped containers. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_last (const Containers &... cs) |
| Get last tuple from zipped containers. | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_find_last (Pred &&pred, const Containers &... cs) |
| Find last tuple satisfying predicate. | |
| template<typename Pred , typename... Containers> | |
| size_t | Aleph::stl_zip_find_index (Pred &&pred, const Containers &... cs) |
| Find index of first tuple satisfying predicate. | |
| template<typename T , typename U > | |
| auto | Aleph::stl_unzip (const std::vector< std::pair< T, U > > &pairs) |
| Unzip a vector of pairs into two vectors. | |
| template<typename... Ts> | |
| auto | Aleph::stl_unzip_tuple (const std::vector< std::tuple< Ts... > > &tuples) |
| Unzip a vector of tuples into a tuple of vectors. | |
| template<typename Container > | |
| auto | Aleph::stl_adjacent (const Container &c) |
| Zip adjacent (consecutive) elements of a container. | |
| template<typename Op , typename Container > | |
| auto | Aleph::stl_adjacent_map (Op &&op, const Container &c) |
| Apply function to adjacent pairs of elements. | |
| template<typename Pred , typename Container > | |
| bool | Aleph::stl_adjacent_all (Pred &&pred, const Container &c) |
| Check if predicate holds for all adjacent pairs. | |
| template<typename Pred , typename Container > | |
| bool | Aleph::stl_adjacent_exists (Pred &&pred, const Container &c) |
| Check if predicate holds for any adjacent pair. | |
| template<typename Op , typename... Containers> | |
| auto | Aleph::stl_zip_mapi (Op &&op, const Containers &... cs) |
| Map with index (mapi in ML). | |
| template<typename Pred , typename... Containers> | |
| auto | Aleph::stl_zip_filteri (Pred &&pred, const Containers &... cs) |
| Filter with index (filteri in ML). | |
| template<typename T , typename Op , typename... Containers> | |
| auto | Aleph::stl_zip_scan_left (T init, Op &&op, const Containers &... cs) |
| Scan left (scan_left in ML) - fold with intermediate results. | |
| template<typename Op , typename... Containers> | |
| auto | Aleph::stl_zip_find_mapi (Op &&op, const Containers &... cs) |
| Find and map with index (find_mapi in ML). | |
| template<typename... Containers> | |
| bool | Aleph::stl_zip_equal (const Containers &... cs) |
| Check equality of zipped sequences. | |
| template<typename Eq , typename... Containers> | |
| bool | Aleph::stl_zip_equal_by (Eq &&eq, const Containers &... cs) |
| Check equality with custom comparator. | |
| template<typename... Containers1, typename... Containers2> | |
| int | Aleph::stl_zip_compare (const std::tuple< const Containers1 &... > &cs1, const std::tuple< const Containers2 &... > &cs2) |
| Compare two zipped sequences lexicographically. | |
| template<typename Tuple , typename... Containers> | |
| bool | Aleph::stl_zip_mem (const Tuple &target, const Containers &... cs) |
| Check if a tuple exists in the zipped sequence (mem in ML). | |
| template<typename Key , typename... Containers> | |
| auto | Aleph::stl_zip_assoc (const Key &key, const Containers &... cs) |
| Find value associated with key in zipped pairs (assoc in ML). | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_min (const Containers &... cs) |
| Get minimum tuple according to comparator. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_max (const Containers &... cs) |
| Get maximum tuple according to comparator. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_min_max (const Containers &... cs) |
| Get both min and max in a single pass. | |
| template<typename... Containers> | |
| auto | Aleph::stl_zip_sum (const Containers &... cs) |
| Sum all tuples element-wise (requires + operator on tuple elements). | |
Lazy zip iterators and functional operations for STL containers.
This header provides lazy (non-materializing) zip operations for C++ STL containers such as std::vector, std::list, std::set, std::deque, etc.
Key Features:
Definition in file ah-stl-zip.H.