0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-03-13 21:10:32 +01:00

ircd::json::tuple: Add membership test for keys selection.

This commit is contained in:
Jason Volk 2019-01-16 14:48:35 -08:00
parent 2b12c8a9c5
commit 0cb79728f9

View file

@ -30,6 +30,7 @@ struct ircd::json::keys
struct exclude;
size_t count() const;
bool has(const string_view &) const;
operator vector_view<const string_view>() const;
@ -171,6 +172,24 @@ const
return { this->data(), this->count() };
}
template<class tuple>
bool
ircd::json::keys<tuple>::has(const string_view &key)
const
{
const auto &start
{
begin(*this)
};
const auto &stop
{
start + this->count()
};
return std::find(start, stop, key) != stop;
}
template<class tuple>
size_t
ircd::json::keys<tuple>::count()