From be2224f993b0b1b23788fc80e52d4ce38caefce3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 2 Jul 2001 01:09:41 +0000 Subject: [PATCH] Addition of 'deleter' function. llvm-svn: 121 --- include/llvm/Tools/STLExtras.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/Tools/STLExtras.h b/include/llvm/Tools/STLExtras.h index d7f8320d4cc..933db3a8ff4 100644 --- a/include/llvm/Tools/STLExtras.h +++ b/include/llvm/Tools/STLExtras.h @@ -43,6 +43,18 @@ struct bitwise_or : public binary_function { }; +// deleter - Very very very simple method that is used to invoke operator +// delete on something. It is used like this: +// +// for_each(V.begin(), B.end(), deleter); +// +template +static inline void deleter(T *Ptr) { + delete Ptr; +} + + + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===//