Home | History | Annotate | Download | only in ADT

Lines Matching defs:Optional

1 //===-- Optional.h - Simple variant for passing optional values ---*- C++ -*-=//
10 // This file provides Optional, a template class modeled in the spirit of
12 // a value can be optional.
24 class Optional {
28 explicit Optional() : x(), hasVal(false) {}
29 Optional(const T &y) : x(y), hasVal(true) {}
31 static inline Optional create(const T* y) {
32 return y ? Optional(*y) : Optional();
35 Optional &operator=(const T &y) {
53 struct simplify_type<const Optional<T> > {
55 static SimpleType getSimplifiedValue(const Optional<T> &Val) {
61 struct simplify_type<Optional<T> >
62 : public simplify_type<const Optional<T> > {};
64 /// \brief Poison comparison between two \c Optional objects. Clients needs to
65 /// explicitly compare the underlying values and account for empty \c Optional
71 void operator==(const Optional<T> &X, const Optional<U> &Y);
73 /// \brief Poison comparison between two \c Optional objects. Clients needs to
74 /// explicitly compare the underlying values and account for empty \c Optional
80 void operator!=(const Optional<T> &X, const Optional<U> &Y);
82 /// \brief Poison comparison between two \c Optional objects. Clients needs to
83 /// explicitly compare the underlying values and account for empty \c Optional
89 void operator<(const Optional<T> &X, const Optional<U> &Y);
91 /// \brief Poison comparison between two \c Optional objects. Clients needs to
92 /// explicitly compare the underlying values and account for empty \c Optional
98 void operator<=(const Optional<T> &X, const Optional<U> &Y);
100 /// \brief Poison comparison between two \c Optional objects. Clients needs to
101 /// explicitly compare the underlying values and account for empty \c Optional
107 void operator>=(const Optional<T> &X, const Optional<U> &Y);
109 /// \brief Poison comparison between two \c Optional objects. Clients needs to
110 /// explicitly compare the underlying values and account for empty \c Optional
116 void operator>(const Optional<T> &X, const Optional<U> &Y);