diff --git a/src/aal/algorithm.hpp b/src/aal/algorithm.hpp index 6ef2553..02520d8 100644 --- a/src/aal/algorithm.hpp +++ b/src/aal/algorithm.hpp @@ -1,32 +1,33 @@ #pragma once #include +#include namespace aal { namespace var { template [[nodiscard]] constexpr auto -find(P const pred, I f, I const l, Is... fs) { - while (f != l) { +find(P pred, I f, I const l, Is... fs) +{ + for (;f != l;++f, ((void)++fs, ...)) { if (pred(*f, *fs...)) break; - ++f, (++fs, ...); } return std::tuple{f, fs...}; } template [[nodiscard]] constexpr auto -any_of(P const pred, I f, I const l, Is... fs) { - auto const t = find(pred, f, l, fs...); +any_of(P&& pred, I&& f, I const l, Is&&... fs) { + auto const t = find(std::forward

(pred), std::forward(f), l, + std::forward(fs)...); return std::get<0>(t) != l; } template constexpr auto -transform(Op const op, O o, I f, I const l, Is... fs) { - while (f != l) { +transform(Op op, O o, I f, I const l, Is... fs) { + for (;f != l;++o, (void)++f, ((void)++fs, ...)) { *o = op(*f, *fs...); - ++o, ++f, (++fs, ...); } return o; }