10 #ifndef SRC_INCLUDE_SMASH_ALGORITHMS_H_
11 #define SRC_INCLUDE_SMASH_ALGORITHMS_H_
52 template <
typename Iterator>
54 Iterator begin,
const Iterator &end,
55 typename std::iterator_traits<Iterator>::value_type length) {
56 bool had_to_wrap =
false;
57 for (; begin != end; ++begin) {
62 }
else if (x >= length) {
79 template <
typename Container,
typename UnaryPredicate>
80 inline bool all_of(Container &&c, UnaryPredicate &&
p) {
82 std::forward<UnaryPredicate>(
p));
95 template <
typename Container,
typename UnaryFunction>
96 inline UnaryFunction
for_each(Container &&c, UnaryFunction &&f) {
98 std::forward<UnaryFunction>(f));
UnaryFunction for_each(Container &&c, UnaryFunction &&f)
Convenience wrapper for std::for_each that operates on a complete container.
static bool enforce_periodic_boundaries(Iterator begin, const Iterator &end, typename std::iterator_traits< Iterator >::value_type length)
Enforces periodic boundaries on the given collection of values.
bool all_of(Container &&c, UnaryPredicate &&p)
Convenience wrapper for std::all_of that operates on a complete container.