diff options
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibCore/Object.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibCore/Object.h b/Libraries/LibCore/Object.h index b76b7ff7cd..d007818b0e 100644 --- a/Libraries/LibCore/Object.h +++ b/Libraries/LibCore/Object.h @@ -120,6 +120,14 @@ public: m_parent->remove_child(*this); } + template<class T, class... Args> + inline NonnullRefPtr<T> add(Args&&... args) + { + auto t = T::construct(forward<Args>(args)...); + add_child(*t); + return t; + } + virtual bool is_visible_for_timer_purposes() const; protected: |