0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::util: Add complement to std::for_each with our ircd::until().

This commit is contained in:
Jason Volk 2017-09-08 01:57:31 -07:00
parent 481eff3baa
commit 0c145d0fbd

View file

@ -1220,5 +1220,25 @@ operator!(const string_view &str)
}
//
// Iterator based until() matching std::for_each except the function
// returns a bool to continue rather than void.
//
template<class it_a,
class it_b,
class boolean_function>
bool
until(it_a a,
const it_b &b,
boolean_function&& f)
{
for(; a != b; ++a)
if(!f(*a))
return false;
return true;
}
} // namespace util
} // namespace ircd