mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
AK+LibWeb: Implement Variant equality operator
And make use of it for CSS StyleValues.
This commit is contained in:
parent
7dc874104b
commit
d00a6ca11f
2 changed files with 12 additions and 31 deletions
|
@ -418,6 +418,15 @@ public:
|
|||
return index_of<T>() == m_index;
|
||||
}
|
||||
|
||||
bool operator==(Variant const& other) const
|
||||
{
|
||||
return this->visit([&]<typename T>(T const& self) {
|
||||
if (auto const* p = other.get_pointer<T>())
|
||||
return static_cast<T const&>(self) == static_cast<T const&>(*p);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
template<typename... Fs>
|
||||
ALWAYS_INLINE decltype(auto) visit(Fs&&... functions)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue