Stl-like algorithms for runtime and compile time. More...
Functions | |
void | Ikarus::utils::makeUniqueAndSort (std::ranges::random_access_range auto &r) |
Sorts and removes duplicate elements from a random access range.*. More... | |
template<typename T > | |
auto | Ikarus::utils::appendUnique (std::ranges::random_access_range auto &r, T &&v) |
Appends a value to the range if it is not already present. More... | |
template<class C > | |
void | Ikarus::utils::printContent (C &&c, std::ostream &os=std::cout) |
Prints the contents of a container to the specified output stream. More... | |
template<class C > | |
auto | Ikarus::utils::transformValueRangeToPointerRange (C &cont) |
Transforms a value range to a pointer range. More... | |
template<class C > | |
auto | Ikarus::utils::transformPointerRangeToReferenceRange (C &cont) |
Transforms a pointer range to a reference range. More... | |
template<typename Tuple , typename Predicate > | |
constexpr size_t | Ikarus::utils::find_if (Tuple &&tuple, Predicate pred) |
Finds the index of the first element in the tuple satisfying a predicate. More... | |
template<typename Tuple , typename Predicate > | |
bool | Ikarus::utils::none_of (Tuple &&tuple, Predicate pred) |
Checks if none of the elements in the tuple satisfy a given predicate. More... | |
template<typename Tuple , typename Predicate > | |
bool | Ikarus::utils::any_of (Tuple &&tuple, Predicate pred) |
Checks if any of the elements in the tuple satisfy a given predicate. More... | |
template<typename Tuple , typename Predicate > | |
auto | Ikarus::utils::filter (Tuple &&tuple, Predicate pred) |
Filters the elements of a tuple based on a given predicate. More... | |
template<typename... Types> | |
constexpr auto | Ikarus::utils::unique (std::tuple< Types... > &&tuple) |
Creates a tuple with unique types from the given tuple. More... | |
template<typename Tuple , typename Predicate > | |
constexpr size_t | Ikarus::utils::count_if (Tuple &&tuple, Predicate pred) |
Counts the number of elements in the tuple satisfying the given predicate. More... | |
template<template< auto... > class Type, typename Tuple > | |
constexpr int | Ikarus::utils::findTypeSpecialization () |
Finds the index of the first element in the tuple that is a specialization of the given template type. More... | |
template<template< auto... > class Type, typename Tuple > | |
auto | Ikarus::utils::getSpecialization (Tuple &&tuple) |
Gets the specialization of the given template type from the tuple. More... | |
template<template< auto... > class Type, typename Tuple > | |
constexpr bool | Ikarus::utils::hasTypeSpecialization () |
Checks if a tuple has a specialization of a template type. More... | |
template<template< auto... > class Type, typename Tuple > | |
constexpr bool | Ikarus::utils::countTypeSpecialization () |
Counts the occurrences of a specialization of a template type in a tuple. More... | |
template<int N, class Tuple > | |
constexpr auto | Ikarus::utils::makeTupleSubset (Tuple &&t) |
Creates a subset tuple with the first N elements from the given tuple. More... | |
template<class Tuple , std::size_t... I> | |
constexpr auto | Ikarus::utils::makeTupleFromTupleIndices (Tuple &&t) |
Creates a new tuple using indices from the original tuple. More... | |
Variables | |
template<template< auto... > class Type, typename Tuple > | |
static constexpr bool | Ikarus::utils::countTypeSpecialization_v = countTypeSpecialization<Type, Tuple>() |
Variable template for counting the occurrences of a specialization of a template type in a tuple. More... | |
bool Ikarus::utils::any_of | ( | Tuple && | tuple, |
Predicate | pred | ||
) |
Tuple | Type of the input tuple. |
Predicate | Type of the predicate function. |
tuple | Input tuple. |
pred | Predicate function to check each element. |
auto Ikarus::utils::appendUnique | ( | std::ranges::random_access_range auto & | r, |
T && | v | ||
) |
This function appends a value to the given random access range only if the value is not already present in the range. It returns the index of the value in the range, whether it was added or already existed.
T | The type of the value to be appended. |
r | The random access range to be modified. |
v | The value to be appended. |
|
constexpr |
Tuple | Type of the tuple. |
Predicate | Predicate function determining whether an element satisfies the condition. |
tuple | Input tuple. |
pred | Predicate function. |
This function counts the number of elements in the tuple that satisfy the given predicate.
|
constexpr |
Type | Template type to count occurrences for. |
Tuple | Type of the tuple. |
This function counts the occurrences of a specialization of a template type in a tuple.
auto Ikarus::utils::filter | ( | Tuple && | tuple, |
Predicate | pred | ||
) |
Tuple | Type of the input tuple. |
Predicate | Type of the predicate function. |
tuple | Input tuple. |
pred | Predicate function to filter the elements. |
This function applies the given predicate to each element of the tuple. It constructs a new tuple containing only those elements for which the predicate returns true. The resulting tuple is returned.
|
constexpr |
Tuple | Type of the input tuple. |
Predicate | Type of the predicate function. |
tuple | Input tuple. |
pred | Predicate function to check each element. |
This function takes a tuple and a predicate function and finds the index of the first element in the tuple that satisfies the given predicate. It uses Dune::Hybrid::forEach to iterate through the tuple.
|
constexpr |
Type | Template type to search for. |
Tuple | Type of the tuple. |
This function finds the index of the first element in the tuple that is a specialization of the given template type. It returns the size of the tuple if the template type is not found
auto Ikarus::utils::getSpecialization | ( | Tuple && | tuple | ) |
Type | Template type to search for. |
Tuple | Type of the tuple. |
tuple | The tuple containing elements. |
This function retrieves the specialization of a template type from the tuple.
|
constexpr |
Type | Template type to check for. |
Tuple | Type of the tuple. |
This function checks if a tuple has a specialization of a template type. It uses find_if
to search for the type and returns true if the index is less than the tuple size; otherwise, false.
|
constexpr |
Tuple | Type of the original tuple. |
I | Indices to include in the new tuple. |
t | The original tuple. |
This function creates a new tuple using indices from the original tuple. It uses makeTupleFromTupleIndicesImpl
from the Impl
namespace to implement the tuple creation.
|
constexpr |
N | Number of elements in the subset. |
Tuple | Type of the original tuple. |
t | The original tuple. |
This function creates a subset tuple with the first N elements from the given tuple.
void Ikarus::utils::makeUniqueAndSort | ( | std::ranges::random_access_range auto & | r | ) |
This function sorts the elements of the given random access range and removes duplicate elements, leaving only unique elements in the range.
r | The random access range to be modified. |
bool Ikarus::utils::none_of | ( | Tuple && | tuple, |
Predicate | pred | ||
) |
Tuple | Type of the input tuple. |
Predicate | Type of the predicate function. |
tuple | Input tuple. |
pred | Predicate function to check each element. |
void Ikarus::utils::printContent | ( | C && | c, |
std::ostream & | os = std::cout |
||
) |
This function prints the contents of the given container to the specified output stream.
C | The type of the container to be printed. |
c | The container whose contents will be printed. |
os | The output stream where the contents will be printed. Default is std::cout. |
auto Ikarus::utils::transformPointerRangeToReferenceRange | ( | C & | cont | ) |
This function transforms a range of pointers to a range of references.
C | The type of the container containing pointers. |
cont | The container whose pointers will be transformed to references. |
auto Ikarus::utils::transformValueRangeToPointerRange | ( | C & | cont | ) |
C | The type of the container containing values. |
cont | The container whose values will be transformed to pointers. |
|
constexpr |
Types | Variadic template parameters representing types. |
tuple | Input tuple. |
This function takes a tuple and returns a new tuple containing only unique types from the input tuple.
|
staticconstexpr |
Type | Template type to count occurrences for. |
Tuple | Type of the tuple. |
This variable template provides a compile-time constant for the count of occurrences of a specialization of a template type in a tuple.