aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-10-26 16:58:58 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-10-26 17:01:20 +0100
commit9d5e9ef0da89fe4fd02d7053ee28d79df3245325 (patch)
tree2cd78cf64f40b2f110eadcd85fc5b27b0e7352ff /src/libutil
parentdc7d1322efbaa176bff38b1ad15eab6e11c83340 (diff)
Move Explicit
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/types.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index 6c4c5ab74..9c85fef62 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -34,4 +34,16 @@ struct OnStartup
OnStartup(T && t) { t(); }
};
+/* Wrap bools to prevent string literals (i.e. 'char *') from being
+ cast to a bool in Attr. */
+template<typename T>
+struct Explicit {
+ T t;
+
+ bool operator ==(const Explicit<T> & other) const
+ {
+ return t == other.t;
+ }
+};
+
}