mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 13:01:07 +01:00
ircd:Ⓜ️:room: Add head::has() existential test.
This commit is contained in:
parent
4cd0570d56
commit
ad2f823056
2 changed files with 16 additions and 0 deletions
|
@ -360,6 +360,7 @@ struct ircd::m::room::head
|
|||
|
||||
bool for_each(const closure_bool &) const;
|
||||
void for_each(const closure &) const;
|
||||
bool has(const event::id &) const;
|
||||
size_t count() const;
|
||||
|
||||
head(const m::room &room)
|
||||
|
|
|
@ -1510,6 +1510,21 @@ const
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::room::head::has(const event::id &event_id)
|
||||
const
|
||||
{
|
||||
bool ret{false};
|
||||
for_each(closure_bool{[&ret, &event_id]
|
||||
(const event::idx &event_idx, const event::id &event_id_)
|
||||
{
|
||||
ret = event_id_ == event_id;
|
||||
return !ret; // for_each protocol: false to break
|
||||
}});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::room::head::for_each(const closure &closure)
|
||||
const
|
||||
|
|
Loading…
Reference in a new issue