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:
Andreas Kling 2020-05-08 22:10:47 +02:00
commit 55f61c0004
Notes: sideshowbarker 2024-07-19 06:49:58 +09:00
8 changed files with 57 additions and 16 deletions

View file

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