summaryrefslogtreecommitdiff
path: root/utils/null_traits.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-21 03:07:42 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-21 03:07:42 +0000
commit0739f499287761abbcff3a3cf0e4c6ae3b0f1492 (patch)
tree797b7e1aee8241e1322cd19143412d6108571be8 /utils/null_traits.h
parent0cd14905d32c1f0c70da6a4f6683af4af5966125 (diff)
agenda for fsa
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@612 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/null_traits.h')
-rwxr-xr-xutils/null_traits.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/null_traits.h b/utils/null_traits.h
new file mode 100755
index 00000000..fac857d9
--- /dev/null
+++ b/utils/null_traits.h
@@ -0,0 +1,26 @@
+#ifndef NULL_TRAITS_H
+#define NULL_TRAITS_H
+
+template <class V>
+struct null_traits {
+ static V null; //TODO: maybe take out default null and make ppl explicitly define? they may be surprised that they need to when they include a header lib that uses null_traits
+};
+// global bool is_null(V const& v)
+
+// definitely override this, and possibly set_null and is_null. that's the point.
+template <class V>
+V null_traits<V>::null;
+//TODO: are we getting single init of the static null object?
+
+template <class V>
+void set_null(V &v) {
+ v=null_traits<V>::null;
+}
+
+template <class V>
+void is_null(V const& v) {
+ return v==null_traits<V>::null;
+}
+
+
+#endif