I misunderstand this question, or is it something you could do through std::accumulate ?
using eana = std::tuple<bool, bool, bool, bool>; template <typename T, typename FwdIt, typename Pred> auto empty_all_none_any(FwdIt begin, FwdIt end, Pred predicate) -> eana { auto result = eana{begin == end, begin != end, begin != end, false}; result = std::accumulate(begin, end, result, [&](eana& res, T& val) { if (predicate(val)) { std::get<2>(res) = false; std::get<3>(res) = true; } else { std::get<1>(res) = false; } return res; }); return result; }
Kolja source share