2021-07-20 20:41:38 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/IntrusiveList.h>
|
|
|
|
|
|
|
|
namespace AK {
|
2021-09-09 15:00:59 +03:00
|
|
|
namespace Detail {
|
2021-07-20 20:41:38 +03:00
|
|
|
|
|
|
|
template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
|
|
|
|
class IntrusiveListRelaxedConst : public IntrusiveList<T, Container, member> {
|
|
|
|
AK_MAKE_NONCOPYABLE(IntrusiveListRelaxedConst);
|
|
|
|
AK_MAKE_NONMOVABLE(IntrusiveListRelaxedConst);
|
|
|
|
|
|
|
|
public:
|
|
|
|
using IntrusiveList<T, Container, member>::IntrusiveList;
|
|
|
|
|
2021-08-07 19:20:45 +03:00
|
|
|
using Iterator = typename IntrusiveList<T, Container, member>::Iterator;
|
2021-07-20 20:41:38 +03:00
|
|
|
|
|
|
|
Iterator begin() const { return const_cast<IntrusiveListRelaxedConst*>(this)->IntrusiveList<T, Container, member>::begin(); }
|
|
|
|
Iterator end() const { return Iterator {}; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-09-09 15:00:59 +03:00
|
|
|
template<auto member>
|
|
|
|
using IntrusiveListRelaxedConst = Detail::IntrusiveListRelaxedConst<
|
|
|
|
decltype(Detail::ExtractIntrusiveListTypes::value(member)),
|
|
|
|
decltype(Detail::ExtractIntrusiveListTypes::container(member)),
|
|
|
|
member>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-26 14:18:30 +03:00
|
|
|
#if USING_AK_GLOBALLY
|
2021-07-20 20:41:38 +03:00
|
|
|
using AK::IntrusiveListRelaxedConst;
|
2022-11-26 14:18:30 +03:00
|
|
|
#endif
|