mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::stats: Add bang operator to vtable for zero query.
This commit is contained in:
parent
338cec879a
commit
1580004edc
1 changed files with 17 additions and 0 deletions
|
@ -81,6 +81,8 @@ struct ircd::stats::item<void>
|
|||
// Access features
|
||||
string_view operator[](const string_view &key) const noexcept;
|
||||
|
||||
virtual bool operator!() const = 0;
|
||||
|
||||
item() = default;
|
||||
item(const std::type_index &, const json::members &);
|
||||
item(item &&) = delete;
|
||||
|
@ -95,6 +97,11 @@ struct ircd::stats::item<uint64_t *>
|
|||
uint64_t *val {nullptr};
|
||||
|
||||
public:
|
||||
bool operator!() const override
|
||||
{
|
||||
return !val || !*val;
|
||||
}
|
||||
|
||||
operator const uint64_t &() const
|
||||
{
|
||||
assert(val);
|
||||
|
@ -118,6 +125,11 @@ struct ircd::stats::item<uint32_t *>
|
|||
uint32_t *val {nullptr};
|
||||
|
||||
public:
|
||||
bool operator!() const override
|
||||
{
|
||||
return !val || !*val;
|
||||
}
|
||||
|
||||
operator const uint32_t &() const
|
||||
{
|
||||
assert(val);
|
||||
|
@ -141,6 +153,11 @@ struct ircd::stats::item<uint16_t *>
|
|||
uint16_t *val {nullptr};
|
||||
|
||||
public:
|
||||
bool operator!() const override
|
||||
{
|
||||
return !val || !*val;
|
||||
}
|
||||
|
||||
operator const uint16_t &() const
|
||||
{
|
||||
assert(val);
|
||||
|
|
Loading…
Reference in a new issue