chore(eventsub): add operator== and indicator for shared chat (#5974)
This commit is contained in:
@@ -152,6 +152,24 @@ struct String {
|
||||
return (this->flags & (ALLOC_BIT | QT_BIT)) == 0;
|
||||
}
|
||||
|
||||
// note: because we're using C++ 20, the reversed operator
|
||||
// (e.g. QAnyStringView == String) is automatically "synthesized".
|
||||
bool operator==(const QAnyStringView &other) const noexcept
|
||||
{
|
||||
return this->view() == other;
|
||||
}
|
||||
|
||||
bool operator==(const String &other) const noexcept
|
||||
{
|
||||
return this->view() == other.view();
|
||||
}
|
||||
|
||||
template <typename = void> // weak overload
|
||||
bool operator==(const std::string_view &other) const noexcept
|
||||
{
|
||||
return this->view() == other;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr size_t QT_BIT = 1ULL << (sizeof(size_t) * 8 - 1);
|
||||
static constexpr size_t ALLOC_BIT = 1ULL << (sizeof(size_t) * 8 - 2);
|
||||
|
||||
Reference in New Issue
Block a user