]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/stdalgo.h
m_passforward: Don't forward password if the connect block required a password to...
[user/henk/code/inspircd.git] / include / stdalgo.h
index 3cbb8635021e05042ccd4611450567c1ff90983a..afbd763fb259eca74f9543afdf75f68b17361005 100644 (file)
@@ -75,4 +75,23 @@ namespace stdalgo
                        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>());
+       }
 }