0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd:Ⓜ️:event::refs: Add overload to check if ref type exists.

This commit is contained in:
Jason Volk 2019-07-16 10:22:49 -07:00
parent ecdd5c153c
commit 13830061a3
2 changed files with 14 additions and 1 deletions

View file

@ -33,6 +33,7 @@ struct ircd::m::event::refs
bool has(const dbs::ref &type, const event::idx &) const noexcept;
bool has(const event::idx &) const noexcept;
bool has(const dbs::ref &) const noexcept;
size_t count(const dbs::ref &type) const noexcept;
size_t count() const noexcept;

View file

@ -2815,7 +2815,7 @@ const noexcept
assert(idx);
size_t ret(0);
for_each(type, [&ret]
(const event::idx &ref, const dbs::ref &)
(const event::idx &, const dbs::ref &)
{
++ret;
return true;
@ -2824,6 +2824,18 @@ const noexcept
return ret;
}
bool
ircd::m::event::refs::has(const dbs::ref &type)
const noexcept
{
return !for_each(type, [&type]
(const event::idx &, const dbs::ref &ref)
{
assert(ref == type);
return false;
});
}
bool
ircd::m::event::refs::has(const event::idx &idx)
const noexcept