Needed addtl cleanup template.
authorcantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Sun, 4 Feb 2007 23:47:13 +0000 (23:47 +0000)
committercantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Sun, 4 Feb 2007 23:47:13 +0000 (23:47 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@244 de75baf8-a10c-0410-a50a-987c0e22f00f

xmltooling/base.h

index 8e6eb90..3b2529f 100644 (file)
@@ -1509,6 +1509,19 @@ namespace xmltooling {
          */
         void operator()(const std::pair<A,B*>& p) {delete p.second;}
     };
+
+    /**
+     * Functor for cleaning up const heap objects in key/value containers.
+     */
+    template<class A,class B> struct cleanup_const_pair
+    {
+        /**
+         * Function operator to delete an object stored as const
+         * 
+         * @param p   a pair in which the second component is the const object to delete
+         */
+        void operator()(const std::pair<A,const B*>& p) {delete const_cast<B*>(p.second);}
+    };
 };
 
 #endif /* __xmltooling_base_h__ */