aboutsummaryrefslogtreecommitdiffstats
path: root/include/stl_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stl_util.h')
-rw-r--r--include/stl_util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/stl_util.h b/include/stl_util.h
index f1ffbff52..0ba73a93a 100644
--- a/include/stl_util.h
+++ b/include/stl_util.h
@@ -51,6 +51,25 @@ inline R search_map(const std::map<K, V>& mapping, const K& key,
}
/*************************************************
+* Function adaptor for delete operation *
+*************************************************/
+template<class T>
+class del_fun : public std::unary_function<T, void>
+ {
+ public:
+ void operator()(T* ptr) { delete ptr; }
+ };
+
+/*************************************************
+* Delete the second half of a pair of objects *
+*************************************************/
+template<typename Pair>
+void delete2nd(Pair& pair)
+ {
+ delete pair.second;
+ }
+
+/*************************************************
* Insert a key/value pair into a multimap *
*************************************************/
template<typename K, typename V>