From ef0fecc856d435ff140ce87ca38618d6edceafcc Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 24 Mar 2014 16:50:48 +0100 Subject: Add stdalgo::delete_all() that deletes all elements in a container --- src/modules/m_customprefix.cpp | 3 +-- src/modules/m_showfile.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index 107c6d684..65c2cbd31 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -76,8 +76,7 @@ class ModuleCustomPrefix : public Module ~ModuleCustomPrefix() { - for (std::vector::iterator i = modes.begin(); i != modes.end(); i++) - delete *i; + stdalgo::delete_all(modes); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp index 0f5d3ed1a..c42877eef 100644 --- a/src/modules/m_showfile.cpp +++ b/src/modules/m_showfile.cpp @@ -127,12 +127,6 @@ class ModuleShowFile : public Module newcmds.push_back(sfcmd); } - static void DelAll(const std::vector& list) - { - for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) - delete *i; - } - public: void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { @@ -157,13 +151,13 @@ class ModuleShowFile : public Module std::sort(newcmds.begin(), newcmds.end()); std::set_difference(cmds.begin(), cmds.end(), newcmds.begin(), newcmds.end(), removed.begin()); - DelAll(removed); + stdalgo::delete_all(removed); cmds.swap(newcmds); } ~ModuleShowFile() { - DelAll(cmds); + stdalgo::delete_all(cmds); } Version GetVersion() CXX11_OVERRIDE -- cgit v1.2.3