mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
Kernel: Add for_each_vmobject_of_type<T>
This makes iterating over a specific type of VMObjects a bit nicer.
This commit is contained in:
parent
239fd33405
commit
55f61c0004
8 changed files with 57 additions and 16 deletions
|
@ -84,4 +84,14 @@ private:
|
|||
VMObject(VMObject&&) = delete;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline bool is(const VMObject&) { return false; }
|
||||
|
||||
template<typename T>
|
||||
inline T& to(VMObject& object)
|
||||
{
|
||||
ASSERT(is<typename RemoveConst<T>::Type>(object));
|
||||
return static_cast<T&>(object);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue