LibGUI: Make GUI::TabWidget::add_tab<T>() return a T&

Since the newly constructed sub-widget is owned by the TabWidget,
we can simply return a T& here. :^)
This commit is contained in:
Andreas Kling 2020-04-04 11:10:07 +02:00
commit 2463a285ee
Notes: sideshowbarker 2024-07-19 07:57:36 +09:00
6 changed files with 41 additions and 41 deletions

View file

@ -55,11 +55,11 @@ public:
void add_widget(const StringView&, Widget&);
template<class T, class... Args>
inline NonnullRefPtr<T> add_tab(const StringView& title, Args&&... args)
T& add_tab(const StringView& title, Args&&... args)
{
auto t = T::construct(forward<Args>(args)...);
add_widget(title, *t);
return t;
return *t;
}
protected: