/* * Copyright (c) 2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace AK { namespace Detail { template T::*member> class IntrusiveListRelaxedConst : public IntrusiveList { AK_MAKE_NONCOPYABLE(IntrusiveListRelaxedConst); AK_MAKE_NONMOVABLE(IntrusiveListRelaxedConst); public: using IntrusiveList::IntrusiveList; using Iterator = typename IntrusiveList::Iterator; Iterator begin() const { return const_cast(this)->IntrusiveList::begin(); } Iterator end() const { return Iterator {}; } }; } template using IntrusiveListRelaxedConst = Detail::IntrusiveListRelaxedConst< decltype(Detail::ExtractIntrusiveListTypes::value(member)), decltype(Detail::ExtractIntrusiveListTypes::container(member)), member>; } #if USING_AK_GLOBALLY using AK::IntrusiveListRelaxedConst; #endif