#include <algorithm>#include <numeric>#include <functional>#include <promeki/core/namespace.h>#include <promeki/core/list.h>
Go to the source code of this file.
Functions | |
| template<typename Container > | |
| PROMEKI_NAMESPACE_BEGIN Container | sorted (Container c) |
| Returns a sorted copy of the container. | |
| template<typename Container , typename Compare > | |
| Container | sorted (Container c, Compare comp) |
| Returns a sorted copy of the container using a custom comparator. | |
| template<typename Container , typename Predicate > | |
| Container | filtered (const Container &c, Predicate pred) |
| Returns a copy of the container with only elements matching the predicate. | |
| template<typename Container , typename Transform > | |
| auto | mapped (const Container &c, Transform fn) |
| Returns a container of transformed elements. | |
| template<typename Container , typename Predicate > | |
| bool | allOf (const Container &c, Predicate pred) |
| Returns true if all elements satisfy the predicate. | |
| template<typename Container , typename Predicate > | |
| bool | anyOf (const Container &c, Predicate pred) |
| Returns true if any element satisfies the predicate. | |
| template<typename Container , typename Predicate > | |
| bool | noneOf (const Container &c, Predicate pred) |
| Returns true if no elements satisfy the predicate. | |
| template<typename Container , typename Callable > | |
| void | forEach (const Container &c, Callable fn) |
| Applies a callable to each element. | |
| template<typename Container , typename Init , typename BinaryOp > | |
| Init | accumulate (const Container &c, Init init, BinaryOp op) |
| Folds/reduces the container with a binary operation. | |
| template<typename Container > | |
| auto | minElement (const Container &c) |
| Returns an iterator to the minimum element. | |
| template<typename Container > | |
| auto | maxElement (const Container &c) |
| Returns an iterator to the maximum element. | |
| template<typename Container , typename Value > | |
| bool | contains (const Container &c, const Value &val) |
| Returns true if the container contains the given value. | |
See LICENSE file in the project root folder for license information.
Folds/reduces the container with a binary operation.
| Container | A container with begin()/end(). |
| Init | The accumulator initial value type. |
| BinaryOp | A binary operation. |
| c | The container. |
| init | The initial value. |
| op | The binary operation. |
Returns true if all elements satisfy the predicate.
| Container | A container with begin()/end(). |
| Predicate | A unary predicate. |
| c | The container. |
| pred | The predicate. |
Returns true if any element satisfies the predicate.
| Container | A container with begin()/end(). |
| Predicate | A unary predicate. |
| c | The container. |
| pred | The predicate. |
Returns true if the container contains the given value.
| Container | A container with begin()/end(). |
| Value | The value type. |
| c | The container. |
| val | The value to search for. |
Returns a copy of the container with only elements matching the predicate.
| Container | A container with begin()/end(). |
| Predicate | A unary predicate. |
| c | The source container. |
| pred | The predicate. |
Applies a callable to each element.
| Container | A container with begin()/end(). |
| Callable | A unary function. |
| c | The container. |
| fn | The function to apply. |
Returns a container of transformed elements.
| Container | A container with begin()/end() and a value_type. |
| Transform | A unary transformation function. |
| c | The source container. |
| fn | The transform function. |
Returns an iterator to the maximum element.
| Container | A container with begin()/end(). |
| c | The container. |
Returns an iterator to the minimum element.
| Container | A container with begin()/end(). |
| c | The container. |
Returns true if no elements satisfy the predicate.
| Container | A container with begin()/end(). |
| Predicate | A unary predicate. |
| c | The container. |
| pred | The predicate. |
Returns a sorted copy of the container using a custom comparator.
| Container | A container with begin()/end() and a copy constructor. |
| Compare | A binary comparison function. |
| c | The source container. |
| comp | The comparator. |