summaryrefslogtreecommitdiff
path: root/utils/null_traits.h
blob: fac857d93d80ee86db376e171c2503def62c7dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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