From 95a83543f205bd806021eecd71098630babdd136 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Aug 2016 10:14:29 -0400 Subject: [PATCH] intrusive_list: Get rid of unnecessary static_casts The only valid objects to add to the list are those that inherit from IntrusiveListNode. Therefore anything being added to the list that isn't inheriting from it will cause compilation to fail. --- src/common/intrusive_list.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/intrusive_list.h b/src/common/intrusive_list.h index 084e57e3..e30d8f4e 100644 --- a/src/common/intrusive_list.h +++ b/src/common/intrusive_list.h @@ -47,7 +47,7 @@ public: * @param node Node to add to the list. */ void Prepend(T& node) { - AddAfter(root.get(), static_cast*>(&node)); + AddAfter(root.get(), &node); } /** @@ -55,7 +55,7 @@ public: * @param node Node to add to the list. */ void Append(T& node) { - AddBefore(root.get(), static_cast*>(&node)); + AddBefore(root.get(), &node); } /** @@ -64,7 +64,7 @@ public: * @param new_node Node to add to the list. */ void AddAfter(T& existing, T& node) { - AddAfter(static_cast*>(&existing), static_cast*>(&node)); + AddAfter(&existing, &node); } /** @@ -73,7 +73,7 @@ public: * @param new_node Node to add to the list. */ void AddBefore(T& existing, T& node) { - AddBefore(static_cast*>(&existing), static_cast*>(&node)); + AddBefore(&existing, &node); } /** @@ -208,7 +208,7 @@ IntrusiveListIterator IntrusiveList::erase(const IntrusiveListIterator& template IntrusiveListIterator IntrusiveList::iterator_to(T& item) { - return IntrusiveListIterator(root.get(), static_cast*>(&item)); + return IntrusiveListIterator(root.get(), &item); } template @@ -223,7 +223,7 @@ IntrusiveListIterator IntrusiveList::end() const { template IntrusiveListIterator IntrusiveList::iterator_to(T& item) const { - return IntrusiveListIterator(root.get(), static_cast*>(&item)); + return IntrusiveListIterator(root.get(), &item); } } // namespace Common