containerDelete.h

Go to the documentation of this file.
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 }//namespace
00040 #endif

Generated on Mon Sep 24 14:19:10 2007 for AtlfastAlgs by  doxygen 1.5.1