version 0.4.1
algorithms.hh File Reference

Implementation of several stl-like algorithms. More...

#include <iosfwd>
#include <ranges>
#include <ikarus/utils/traits.hh>

Go to the source code of this file.

Namespaces

namespace  Ikarus
 
namespace  Ikarus::utils
 

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...
 
template<typename... Types>
auto Ikarus::utils::makeNestedTupleFlat (std::tuple< Types... >)
 Creates a flattened nested tuple. More...
 
template<typename Tuple >
auto Ikarus::utils::makeNestedTupleFlatAndStoreReferences (Tuple &&tup)
 Creates a flattened nested tuple and stores references. More...
 
template<typename T >
requires traits::Pointer<T>
auto & Ikarus::utils::returnReferenceOrNulloptIfObjectIsNullPtr (T v)
 Returns a reference or std::nullopt if the object is a nullptr. 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...