6 template <class T> struct maybe {
10 maybe(const maybe & other) {
17 const maybe & operator =(const maybe & other) {
19 isJust = other.isJust;
20 if(isJust) new(&t) T(other.t);
23 operator T &() { assert(isJust); return t; }
24 operator bool() { return isJust; }
28 static inline maybe<T> nothing() {return maybe<T>();}
30 static inline maybe<T> just(const T & t_) { maybe<T> m; m.isJust = true; new(&m.t) T(t_); return m; }