Skip to content

Commit

Permalink
AK: Fix IntrusvieList::take_first/last() actually compile with RefPtr<T>
Browse files Browse the repository at this point in the history
PR SerenityOS#6376 made IntrusiveList capable of holding RefPtr<T>, etc. however
there was a latent bug where take_first() / take_last() would fail to
compile because they weren't being converted to their container type.
  • Loading branch information
bgianfo authored and linusg committed Apr 21, 2021
1 parent 0e63a72 commit 93e5ba2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AK/IntrusiveList.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ inline Container IntrusiveList<T, Container, member>::first() const
template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
inline Container IntrusiveList<T, Container, member>::take_first()
{
if (auto* ptr = first()) {
if (Container ptr = first()) {
remove(*ptr);
return ptr;
}
Expand All @@ -256,7 +256,7 @@ inline Container IntrusiveList<T, Container, member>::take_first()
template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
inline Container IntrusiveList<T, Container, member>::take_last()
{
if (auto* ptr = last()) {
if (Container ptr = last()) {
remove(*ptr);
return ptr;
}
Expand Down

0 comments on commit 93e5ba2

Please sign in to comment.