0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-02 00:38:24 +02:00

ircd::stats: Add bang operator to vtable for zero query.

This commit is contained in:
Jason Volk 2020-06-17 19:17:46 -07:00
parent 338cec879a
commit 1580004edc

View file

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