0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-26 02:18:53 +02:00

ircd:Ⓜ️:room: Add head::has() existential test.

This commit is contained in:
Jason Volk 2018-05-05 02:12:48 -07:00
parent 4cd0570d56
commit ad2f823056
2 changed files with 16 additions and 0 deletions

View file

@ -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)

View file

@ -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