SpECTRE  v2024.09.29
alg Namespace Reference

Utility functions wrapping STL algorithms and additional algorithms. More...

Functions

template<class Container , class UnaryPredicate >
decltype(auto) all_of (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around std::all_of.
 
template<class Container , class UnaryPredicate >
decltype(auto) any_of (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around std::any_of.
 
template<class Container , class UnaryPredicate >
decltype(auto) none_of (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around std::none_of.
 
template<class Container , class T >
decltype(auto) count (const Container &c, const T &value)
 Convenience wrapper around std::count.
 
template<class Container , class UnaryPredicate >
decltype(auto) count_if (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around std::count_if.
 
template<class Container , class T >
constexpr decltype(auto) find (Container &&c, const T &value)
 Convenience wrapper around constexpr reimplementation of std::find.
 
template<class Container , class UnaryPredicate >
constexpr decltype(auto) find_if (Container &&c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around constexpr reimplementation of std::find_if.
 
template<class Container , class UnaryPredicate >
constexpr decltype(auto) find_if_not (Container &&c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around constexpr reimplementation of std::find_if_not.
 
template<class Container , class T >
constexpr bool found (const Container &c, const T &value)
 Convenience wrapper around constexpr reimplementation of std::find, returns true if value is in c.
 
template<class Container , class UnaryPredicate >
constexpr bool found_if (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around constexpr reimplementation of std::find_if, returns true if the result of cpp20::find_if is not equal to end(c).
 
template<class Container , class UnaryPredicate >
constexpr bool found_if_not (const Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around constexpr reimplementation of std::find_if_not, returns true if the result of cpp20::find_if_not is not equal to end(c).
 
template<class Container , class Container2 >
decltype(auto) equal (const Container &lhs, const Container2 &rhs)
 Convenience wrapper around std::equal, assumes containers lhs has at least as many elements as rhs.
 
template<class Container , class Container2 , class BinaryPredicate >
decltype(auto) equal (const Container &lhs, const Container2 &rhs, BinaryPredicate &&p)
 Convenience wrapper around std::equal, assumes containers lhs has at least as many elements as rhs.
 
template<class Container >
constexpr decltype(auto) max_element (const Container &c)
 Convenience wrapper around std::max_element.
 
template<class Container , class Compare >
constexpr decltype(auto) max_element (const Container &c, Compare &&comp)
 Convenience wrapper around std::max_element.
 
template<class Container >
constexpr decltype(auto) min_element (const Container &c)
 Convenience wrapper around std::min_element.
 
template<class Container , class Compare >
constexpr decltype(auto) min_element (const Container &c, Compare &&comp)
 Convenience wrapper around std::min_element.
 
template<class Container >
constexpr decltype(auto) minmax_element (const Container &c)
 Convenience wrapper around std::minmax_element.
 
template<class Container , class Compare >
constexpr decltype(auto) minmax_element (const Container &c, Compare &&comp)
 Convenience wrapper around std::minmax_element.
 
template<class Container , class T >
decltype(auto) remove (Container &c, const T &value)
 Convenience wrapper around std::remove.
 
template<class Container , class UnaryPredicate >
decltype(auto) remove_if (Container &c, UnaryPredicate &&unary_predicate)
 Convenience wrapper around std::remove_if.
 
template<class Container , class OutputIt , class Distance , class URBG >
decltype(auto) sample (Container &c, OutputIt out, Distance n, URBG &&g)
 Convience wrapper around std::sample.
 
template<class Container >
decltype(auto) sort (Container &c)
 Convenience wrapper around std::sort.
 
template<class Container , class Compare >
decltype(auto) sort (Container &c, Compare &&comp)
 Convenience wrapper around std::sort.
 
template<class Container , class OutputIt , class UnaryOp >
decltype(auto) transform (const Container &c, OutputIt output_first, UnaryOp &&unary_op)
 Convenience wrapper around std::transform.
 
template<class Container1 , class Container2 , class OutputIt , class BinaryOp >
decltype(auto) transform (const Container1 &c1, const Container2 &c2, OutputIt output_first, BinaryOp &&binary_op)
 Convenience wrapper around std::transform.
 
template<class Container , class T >
constexpr decltype(auto) iota (Container &&c, T value)
 
template<class Container , class T >
decltype(auto) accumulate (const Container &c, T init)
 Convenience wrapper around std::accumulate, returns std::accumulate(begin(c), end(c), init).
 
template<class Container , class T , class BinaryFunction >
decltype(auto) accumulate (const Container &c, T init, BinaryFunction &&f)
 Convenience wrapper around std::accumulate, returns std::accumulate(begin(c), end(c), init, f).
 
template<class Container , class UnaryFunction >
decltype(auto) for_each (const Container &c, UnaryFunction &&f)
 Convenience wrapper around std::for_each, returns the result of std::for_each(begin(c), end(c), f).
 
template<class Container , class UnaryFunction >
decltype(auto) for_each (Container &c, UnaryFunction &&f)
 Convenience wrapper around std::for_each, returns the result of std::for_each(begin(c), end(c), f).
 

Detailed Description

Utility functions wrapping STL algorithms and additional algorithms.