Functional-style container-related algorithms. More...
#include "Molassembler/Temple/Invoke.h"
#include "Molassembler/Temple/AddToContainer.h"
#include <numeric>
Go to the source code of this file.
Data Structures | |
struct | Scine::Molassembler::Temple::Functor::Map< Transformation > |
Namespaces | |
Scine::Molassembler | |
Central library namespace. | |
Scine::Molassembler::Temple | |
Template shorthands, optimizers and constexpr data types. | |
Scine::Molassembler::Temple::Functor | |
Functors for transformations. | |
Functions | |
template<class Container , std::enable_if_t< Traits::hasSize< Container >::value, int > = 0> | |
auto | Scine::Molassembler::Temple::size (const Container &container) |
template<class UnaryFunction , typename T , template< typename, typename...> class Container, template< typename > class... Dependents> | |
auto | Scine::Molassembler::Temple::map_stl (const Container< T, Dependents< T >...> &container, UnaryFunction &&function) |
template<template< typename...> class Tuplelike, typename Unary , typename... Ts, std::enable_if_t<!Traits::isPairlike< Tuplelike< Ts...>>::value &&Traits::isTuplelike< Tuplelike< Ts...>>::value > * = nullptr> | |
constexpr auto | Scine::Molassembler::Temple::map (Tuplelike< Ts...> &&tup, Unary &&f) |
template<typename Pairlike , typename Unary , std::enable_if_t< Traits::isPairlike< Pairlike >::value &&!Traits::isTuplelike< Pairlike >::value > * = nullptr> | |
constexpr auto | Scine::Molassembler::Temple::map (Pairlike &&pair, Unary &&f) |
template<class Container , class UnaryFunction , std::enable_if_t<!Traits::isPairlike< Container >::value &&!Traits::isTuplelike< Container >::value > * = nullptr> | |
auto | Scine::Molassembler::Temple::map (Container &&container, UnaryFunction &&function) |
Maps all values of a container using a unary function. Returns a vector. More... | |
template<class Container , class Callable > | |
void | Scine::Molassembler::Temple::forEach (const Container &container, Callable &&callable) |
Apply a callable for all values of a container. | |
template<class Container , typename ComparisonFunction , typename MappingFunction > | |
Container::const_iterator | Scine::Molassembler::Temple::select (const Container &container, ComparisonFunction &&comparator, MappingFunction &&mapFunction) |
Select a value from a container. More... | |
template<class Container , typename T , class BinaryFunction > | |
T | Scine::Molassembler::Temple::accumulate (const Container &container, T init, BinaryFunction &&reductionFunction) |
Accumulate shorthand. More... | |
template<class Container , class UnaryPredicate = Functor::Identity> | |
bool | Scine::Molassembler::Temple::all_of (const Container &container, UnaryPredicate &&predicate=UnaryPredicate{}) |
all_of shorthand More... | |
template<class Container , class UnaryPredicate = Functor::Identity> | |
bool | Scine::Molassembler::Temple::any_of (const Container &container, UnaryPredicate &&predicate=UnaryPredicate{}) |
any_of shorthand More... | |
template<class Container > | |
void | Scine::Molassembler::Temple::sort (Container &container) |
Calls std::sort on a container. | |
template<class Container , typename Comparator > | |
void | Scine::Molassembler::Temple::sort (Container &container, Comparator &&comparator) |
Calls std::sort with a custom comparator on a container. | |
template<class Container > | |
void | Scine::Molassembler::Temple::reverse (Container &container) |
In-place reversal. | |
template<class Container , typename T > | |
void | Scine::Molassembler::Temple::remove (Container &container, const T &value) |
Applies erase-remove idiom in-place to container. | |
template<class Container , class UnaryFunction > | |
void | Scine::Molassembler::Temple::remove_if (Container &container, UnaryFunction &&predicate) |
Applies erase-remove idiom in-place to container with a predicate function. | |
template<class Container , class Predicate > | |
Container | Scine::Molassembler::Temple::copy_if (const Container &container, Predicate &&predicate) |
template<class Container > | |
Container | Scine::Molassembler::Temple::sorted (Container container) |
template<class Container , typename Comparator > | |
Container | Scine::Molassembler::Temple::sorted (Container container, Comparator &&comparator) |
template<class Container , typename T > | |
auto | Scine::Molassembler::Temple::find (const Container &container, const T &needle) |
std::find shorthand | |
template<class Container , typename UnaryPredicate > | |
auto | Scine::Molassembler::Temple::find_if (const Container &container, UnaryPredicate &&predicate) |
std::find_if shorthand | |
template<class Container , typename T > | |
std::size_t | Scine::Molassembler::Temple::index (const Container &container, const T &needle) |
template<class Container , typename UnaryPredicate > | |
std::size_t | Scine::Molassembler::Temple::index_if (const Container &container, UnaryPredicate &&predicate) |
template<typename T > | |
std::vector< T > | Scine::Molassembler::Temple::iota (unsigned upperBound) |
vector iota shorthand | |
template<class Container > | |
auto | Scine::Molassembler::Temple::makeContainsPredicate (const Container &container) |
Creates a predicate that uses std::find for the container's value type. | |
template<typename Transformation > | |
auto | Scine::Molassembler::Temple::Functor::map (Transformation &&t) |
Functional-style container-related algorithms.