aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/STLUtil.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/STLUtil.hh')
-rw-r--r--src/FbTk/STLUtil.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/FbTk/STLUtil.hh b/src/FbTk/STLUtil.hh
index d427a17..e08036a 100644
--- a/src/FbTk/STLUtil.hh
+++ b/src/FbTk/STLUtil.hh
@@ -26,6 +26,25 @@
26namespace FbTk { 26namespace FbTk {
27namespace STLUtil { 27namespace STLUtil {
28 28
29template<bool C, typename Ta, typename Tb>
30struct IfThenElse;
31
32template<typename Ta, typename Tb>
33struct IfThenElse<true, Ta, Tb> {
34 Ta& operator ()(Ta& ta, Tb& tb) const {
35 return ta;
36 }
37 typedef Ta ResultType;
38};
39
40template<typename Ta, typename Tb>
41struct IfThenElse<false, Ta, Tb> {
42 Tb& operator ()(Ta& ta, Tb& tb) const {
43 return tb;
44 }
45 typedef Tb ResultType;
46};
47
29/// calls delete on each item in the container and then clears the container 48/// calls delete on each item in the container and then clears the container
30template <typename A> 49template <typename A>
31void destroyAndClear(A &a) { 50void destroyAndClear(A &a) {