1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

AK+Everywhere: Reduce the number of template parameters of IntrusiveList

This makes the user-facing type only take the node member pointer, and
lets the compiler figure out the other needed types from that.
This commit is contained in:
Ali Mohammad Pur 2021-09-09 16:30:59 +04:30 committed by Idan Horowitz
parent 93cf01ad7d
commit 5a0cdb15b0
41 changed files with 111 additions and 92 deletions

View file

@ -75,5 +75,5 @@ struct ChunkedBlock : public CommonHeader {
size_t used_chunks() const { return chunk_capacity() - m_free_chunks; }
size_t chunk_capacity() const { return (block_size - sizeof(ChunkedBlock)) / m_size; }
using List = IntrusiveList<ChunkedBlock, RawPtr<ChunkedBlock>, &ChunkedBlock::m_list_node>;
using List = IntrusiveList<&ChunkedBlock::m_list_node>;
};

View file

@ -14,9 +14,9 @@
namespace Core {
IntrusiveList<Object, RawPtr<Object>, &Object::m_all_objects_list_node>& Object::all_objects()
IntrusiveList<&Object::m_all_objects_list_node>& Object::all_objects()
{
static IntrusiveList<Object, RawPtr<Object>, &Object::m_all_objects_list_node> objects;
static IntrusiveList<&Object::m_all_objects_list_node> objects;
return objects;
}

View file

@ -137,7 +137,7 @@ public:
JsonValue property(String const& name) const;
const HashMap<String, NonnullOwnPtr<Property>>& properties() const { return m_properties; }
static IntrusiveList<Object, RawPtr<Object>, &Object::m_all_objects_list_node>& all_objects();
static IntrusiveList<&Object::m_all_objects_list_node>& all_objects();
void dispatch_event(Core::Event&, Object* stay_within = nullptr);

View file

@ -26,7 +26,7 @@ protected:
private:
IntrusiveListNode<MouseTracker> m_list_node;
using List = IntrusiveList<MouseTracker, RawPtr<MouseTracker>, &MouseTracker::m_list_node>;
using List = IntrusiveList<&MouseTracker::m_list_node>;
static List s_trackers;
};

View file

@ -43,7 +43,7 @@ public:
private:
const size_t m_cell_size;
using BlockList = IntrusiveList<HeapBlock, RawPtr<HeapBlock>, &HeapBlock::m_list_node>;
using BlockList = IntrusiveList<&HeapBlock::m_list_node>;
BlockList m_full_blocks;
BlockList m_usable_blocks;
};

View file

@ -35,7 +35,7 @@ private:
IntrusiveListNode<HandleImpl> m_list_node;
public:
using List = IntrusiveList<HandleImpl, RawPtr<HandleImpl>, &HandleImpl::m_list_node>;
using List = IntrusiveList<&HandleImpl::m_list_node>;
};
template<class T>

View file

@ -39,7 +39,7 @@ private:
IntrusiveListNode<MarkedValueList> m_list_node;
public:
using List = IntrusiveList<MarkedValueList, RawPtr<MarkedValueList>, &MarkedValueList::m_list_node>;
using List = IntrusiveList<&MarkedValueList::m_list_node>;
};
}

View file

@ -27,7 +27,7 @@ private:
IntrusiveListNode<WeakContainer> m_list_node;
public:
using List = IntrusiveList<WeakContainer, RawPtr<WeakContainer>, &WeakContainer::m_list_node>;
using List = IntrusiveList<&WeakContainer::m_list_node>;
};
}