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

ircd:Ⓜ️ Add additional query() convenience template.

This commit is contained in:
Jason Volk 2019-08-30 21:32:02 -07:00
parent b38cf0012e
commit 91862e381f

View file

@ -15,6 +15,8 @@ namespace ircd::m
{
template<class R> R query(std::nothrow_t, const event::idx &, const string_view &key, R&& def, const std::function<R (const string_view &)> &);
template<class F> auto query(std::nothrow_t, const event::idx &, const string_view &key, F&&);
template<class R, class F> R query(const event::idx &, const string_view &key, R&& def, F&&);
template<class F> auto query(const event::idx &, const string_view &key, F&&);
}
@ -41,6 +43,17 @@ ircd::m::query(const event::idx &event_idx,
return ret;
}
template<class R,
class F>
R
ircd::m::query(const event::idx &event_idx,
const string_view &key,
R&& r,
F&& f)
{
return query(std::nothrow, event_idx, key, std::forward<R>(r), std::forward<F>(f));
}
/// See other overload documentation first. This overload implements
/// non-throwing behavior when the event_idx/key(column) is not found by
/// calling the closure with a default-constructed string so the closure can