00001 #ifndef ATLFAST_CONTAINERDELETE_H
00002 #define ATLFAST_CONTAINERDELETE_H
00003
00004 #ifndef STD_ALGORITHM_H
00005 #include <algorithm>
00006 #define STD_ALGORITHM_H
00007 #endif
00008
00009
00010 namespace Atlfast{
00011
00013 class DeleteElement{
00014 public:
00016 template<class T>
00017 void operator()(T* ptr){ delete ptr;}
00018 };
00019
00021 template<class Iter>
00022 void containerDelete(Iter begin, Iter end){
00023 std::for_each(begin, end, DeleteElement());
00024 }
00025
00027 template<class Container>
00028 void containerDelete(Container& c){
00029 containerDelete(c.begin(), c.end());
00030 }
00031
00033 template<class Container>
00034 void containerDelete(Container* c){
00035 containerDelete(c.begin(), c.end());
00036 delete c;
00037 }
00038
00039 }
00040 #endif