Lines Matching defs:Maybe

32  * heap memory is used when creating a Maybe<T> object.
35 class Maybe {
40 Maybe();
42 ~Maybe();
44 Maybe(const Maybe& rhs);
47 Maybe(const Maybe<U>& rhs); // NOLINT(implicit)
49 Maybe(Maybe&& rhs);
52 Maybe(Maybe<U>&& rhs); // NOLINT(implicit)
54 Maybe& operator=(const Maybe& rhs);
57 Maybe& operator=(const Maybe<U>& rhs);
59 Maybe& operator=(Maybe&& rhs);
62 Maybe& operator=(Maybe<U>&& rhs);
65 * Construct a Maybe holding a value.
67 Maybe(const T& value); // NOLINT(implicit)
70 * Construct a Maybe holding a value.
72 Maybe(T&& value); // NOLINT(implicit)
96 friend class Maybe;
99 Maybe& copy(const Maybe<U>& rhs);
102 Maybe& move(Maybe<U>&& rhs);
112 Maybe<T>::Maybe() : nothing_(true) {}
115 Maybe<T>::~Maybe() {
122 Maybe<T>::Maybe(const Maybe& rhs) : nothing_(rhs.nothing_) {
130 Maybe<T>::Maybe(const Maybe<U>& rhs) : nothing_(rhs.nothing_) {
137 Maybe<T>::Maybe(Maybe&& rhs) : nothing_(rhs.nothing_) {
149 Maybe<T>::Maybe(Maybe<U>&& rhs) : nothing_(rhs.nothing_) {
160 inline Maybe<T>& Maybe<T>::operator=(const Maybe& rhs) {
167 inline Maybe<T>& Maybe<T>::operator=(const Maybe<U>& rhs) {
173 Maybe<T>& Maybe<T>::copy(const Maybe<U>& rhs) {
195 inline Maybe<T>& Maybe<T>::operator=(Maybe&& rhs) {
197 return move(std::forward<Maybe<T>>(rhs));
202 inline Maybe<T>& Maybe<T>::operator=(Maybe<U>&& rhs) {
203 return move(std::forward<Maybe<U>>(rhs));
208 Maybe<T>& Maybe<T>::move(Maybe<U>&& rhs) {
235 Maybe<T>::Maybe(const T& value) : nothing_(false) {
240 Maybe<T>::Maybe(T&& value) : nothing_(false) {
245 Maybe<T>::operator bool() const {
250 T& Maybe<T>::value() {
251 CHECK(!nothing_) << "Maybe<T>::value() called on Nothing";
256 const T& Maybe<T>::value() const {
257 CHECK(!nothing_) << "Maybe<T>::value() called on Nothing";
262 T Maybe<T>::value_or_default(const T& def) const {
270 void Maybe<T>::destroy() {
275 inline Maybe<typename std::remove_reference<T>::type> make_value(T&& value) {
276 return Maybe<typename std::remove_reference<T>::type>(std::forward<T>(value));
280 inline Maybe<T> make_nothing() {
281 return Maybe<T>();
285 * Define the == operator between Maybe<T> and Maybe<U> only if the operator T
288 * Maybe<> objects
293 const Maybe<T>& a, const Maybe<U>& b) {
307 const Maybe<T>& a, const Maybe<U>& b) {
313 const Maybe<T>& a, const Maybe<U>& b) {