AK: Fix IntrusvieList::take_first/last() actually compile with RefPtr<T>

PR #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.
This commit is contained in:
Brian Gianforcaro 2021-04-19 23:27:26 -07:00 committed by Linus Groh
parent 0e63a7255e
commit 93e5ba2347

View file

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