mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can simply vend a ChildType&. This allows us to use "." instead of "->" at the call site, which is quite nice. :^)
This commit is contained in:
parent
fb09b6a8ce
commit
028c011760
46 changed files with 1035 additions and 1039 deletions
|
@ -121,11 +121,11 @@ public:
|
|||
}
|
||||
|
||||
template<class T, class... Args>
|
||||
inline NonnullRefPtr<T> add(Args&&... args)
|
||||
inline T& add(Args&&... args)
|
||||
{
|
||||
auto t = T::construct(forward<Args>(args)...);
|
||||
add_child(*t);
|
||||
return t;
|
||||
auto child = T::construct(forward<Args>(args)...);
|
||||
add_child(*child);
|
||||
return child;
|
||||
}
|
||||
|
||||
virtual bool is_visible_for_timer_purposes() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue