mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd::json: Add until() with two tuple arguments (for comparisons).
This commit is contained in:
parent
f7708f47f6
commit
48877a31c8
1 changed files with 24 additions and 0 deletions
|
@ -455,6 +455,30 @@ until(tuple &t,
|
||||||
false;
|
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,
|
template<class tuple,
|
||||||
class function,
|
class function,
|
||||||
ssize_t i>
|
ssize_t i>
|
||||||
|
|
Loading…
Reference in a new issue