Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CntrCleaner.hh

Go to the documentation of this file.
00001 
00020 #ifndef MANGO_CONTAINER_CLEANER_H
00021 #define MANGO_CONTAINER_CLEANER_H
00022 
00023     
00024 namespace MangoPtr
00025 {          
00044     template <typename T>
00045     struct CntrCleaner
00046     {
00047         inline static void execute(const T& obj);
00048     };
00050     template <typename T>
00051     struct CntrCleaner<T*> 
00052     {
00053         static void execute(const T* ptr) {delete ptr;}
00054     };
00056     template <typename T>
00057     struct CntrCleaner<T* const> 
00058     {
00059         static void execute(const T* ptr) {delete ptr;}
00060     };
00062     template <typename T>
00063     inline void 
00064     CntrCleaner<T>::execute(const T& obj) 
00065     {
00066         for (typename T::const_iterator ii = obj.begin();
00067              ii != obj.end(); ++ ii) 
00068             CntrCleaner<typename T::value_type>::execute(*ii);
00069     }
00070         
00071 } // namespace
00072 
00073 #endif // MANGO_CONTAINER_CLEANER_H
00074 

Generated on Tue Nov 12 20:43:52 2002 for Mango-ptr Library by doxygen1.2.18