One way to write a delete functor to delete all pointers in a container is:
Now Im wondering if the following is a correct safe delete functor, I'm talking specifically about the pointer reference. Also is the first unary_function template paramater correct? (const T *&)Code:template<typename T> struct Deleter : public std::unary_function<const T *, void> { void operator()(const T *Object) const { delete Object; } };
Code:template<typename T> struct SafeDeleter : public std::unary_function<const T *&, void> { void operator()(const T *&Object) const { delete Object; Object = NULL; } };



LinkBack URL
About LinkBacks


