]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/stdalgo.h
m_spanningtree Explicitly specify the routing for RESYNC as the one inherited from...
[user/henk/code/inspircd.git] / include / stdalgo.h
index 758845312c313828979b38df2e2d639e8dc31b4c..afbd763fb259eca74f9543afdf75f68b17361005 100644 (file)
@@ -63,4 +63,35 @@ namespace stdalgo
                        return false;
                }
        }
+
+       /**
+        * Deleter that uses operator delete to delete the item
+        */
+       template <typename T>
+       struct defaultdeleter
+       {
+               void operator()(T* o)
+               {
+                       delete o;
+               }
+       };
+
+       /**
+        * Deleter that adds the item to the cull list, that is, queues it for
+        * deletion at the end of the current mainloop iteration
+        */
+       struct culldeleter
+       {
+               void operator()(classbase* item);
+       };
+
+       /**
+        * Deletes all elements in a container using operator delete
+        * @param cont The container containing the elements to delete
+        */
+       template <template<typename, typename> class Cont, typename T, typename Alloc>
+       inline void delete_all(const Cont<T*, Alloc>& cont)
+       {
+               std::for_each(cont.begin(), cont.end(), defaultdeleter<T>());
+       }
 }