projects
/
shibboleth
/
cpp-xmltooling.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
65322ba
)
Add cleanup templates.
author
Scott Cantor
<cantor.2@osu.edu>
Mon, 20 Feb 2006 08:15:29 +0000
(08:15 +0000)
committer
Scott Cantor
<cantor.2@osu.edu>
Mon, 20 Feb 2006 08:15:29 +0000
(08:15 +0000)
xmltooling/internal.h
patch
|
blob
|
history
diff --git
a/xmltooling/internal.h
b/xmltooling/internal.h
index
5e6a0f8
..
383fbcf
100644
(file)
--- a/
xmltooling/internal.h
+++ b/
xmltooling/internal.h
@@
-66,6
+66,17
@@
namespace {
//PlugManager m_plugMgr;
\r
};
\r
\r
+ // Template cleanup functors for use with for_each algorithm
\r
+ template<class T> struct cleanup
\r
+ {
\r
+ void operator()(T* ptr) {delete ptr;}
\r
+ void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
\r
+ };
\r
+
\r
+ template<class A,class B> struct cleanup_pair
\r
+ {
\r
+ void operator()(const std::pair<A,B*>& p) {delete p.second;}
\r
+ };
\r
};
\r
\r
#endif /* __xmltooling_internal_h__ */
\r