0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::json: Add until() with two tuple arguments (for comparisons).

This commit is contained in:
Jason Volk 2017-09-21 20:05:30 -07:00
parent f7708f47f6
commit 48877a31c8

View file

@ -455,6 +455,30 @@ until(tuple &t,
false;
}
template<size_t i,
class tuple,
class function>
typename std::enable_if<i == size<tuple>(), bool>::type
until(const tuple &a,
const tuple &b,
function&& f)
{
return true;
}
template<size_t i = 0,
class tuple,
class function>
typename std::enable_if<i < size<tuple>(), bool>::type
until(const tuple &a,
const tuple &b,
function&& f)
{
return f(key<i>(a), val<i>(a), val<i>(b))?
until<i + 1>(a, b, std::forward<function>(f)):
false;
}
template<class tuple,
class function,
ssize_t i>