BRICKS
Small, useful blocks of code, to build bigger things.
Loading...
Searching...
No Matches
algorithm.hpp File Reference
#include <functional>
#include <future>
#include <string>
#include <type_traits>
#include <vector>
#include "bricks/detail/contains.hpp"
#include "bricks/detail/index_of.hpp"
Include dependency graph for algorithm.hpp:

Go to the source code of this file.

Namespaces

namespace  bricks
 

Functions

template<class Container >
auto bricks::keys (const Container &input_map) -> std::vector< typename Container::key_type >
 Get the keys of an associative container.
 
template<class Container >
auto bricks::values (const Container &input_map) -> std::vector< typename Container::mapped_type >
 Get the values of an associative container.
 
template<typename F , typename... FrontArgs>
constexpr auto bricks::bind_front (F &&f, FrontArgs &&... front_args)
 Bind arguments to the front of a function.
 
template<class Container , class Value >
constexpr auto bricks::contains (const Container &container, const Value &value) noexcept -> bool
 Checks whether a container contains a specific value.
 
template<class Container , class UnaryPredicate >
constexpr auto bricks::contains_if (const Container &container, const UnaryPredicate &predicate) -> bool
 Checks if a container contains a value that satisfies a predicate.
 
template<class Container , class Value >
constexpr auto bricks::index_of (const Container &container, const Value &value) noexcept -> std::optional< size_t >
 Get the index of the first occurence of a value in a container.
 
template<class Container , class UnaryPredicate >
constexpr auto bricks::index_of_if (const Container &container, const UnaryPredicate &predicate) -> std::optional< size_t >
 Get the index of the first element in a container for which a predicate is true.
 
template<class T , class Rep , class Period >
auto bricks::is_ready_after (const std::future< T > &future, const std::chrono::duration< Rep, Period > &timeout) noexcept -> bool
 Check whether a future is ready after a timeout.
 
template<class T , class Clock , class Duration >
auto bricks::is_ready_at (const std::future< T > &future, const std::chrono::time_point< Clock, Duration > &timeout) noexcept -> bool
 Check whether a future is ready at a specific time.