0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 16:30:52 +01: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 // Access features
string_view operator[](const string_view &key) const noexcept; string_view operator[](const string_view &key) const noexcept;
virtual bool operator!() const = 0;
item() = default; item() = default;
item(const std::type_index &, const json::members &); item(const std::type_index &, const json::members &);
item(item &&) = delete; item(item &&) = delete;
@ -95,6 +97,11 @@ struct ircd::stats::item<uint64_t *>
uint64_t *val {nullptr}; uint64_t *val {nullptr};
public: public:
bool operator!() const override
{
return !val || !*val;
}
operator const uint64_t &() const operator const uint64_t &() const
{ {
assert(val); assert(val);
@ -118,6 +125,11 @@ struct ircd::stats::item<uint32_t *>
uint32_t *val {nullptr}; uint32_t *val {nullptr};
public: public:
bool operator!() const override
{
return !val || !*val;
}
operator const uint32_t &() const operator const uint32_t &() const
{ {
assert(val); assert(val);
@ -141,6 +153,11 @@ struct ircd::stats::item<uint16_t *>
uint16_t *val {nullptr}; uint16_t *val {nullptr};
public: public:
bool operator!() const override
{
return !val || !*val;
}
operator const uint16_t &() const operator const uint16_t &() const
{ {
assert(val); assert(val);