2
3
4
5
6
7
8
9
10
11
12
13
14
15
17#ifndef MIR_OPTIONAL_VALUE_H_
18#define MIR_OPTIONAL_VALUE_H_
39 bool is_set()
const {
return is_set_; }
57 return std::move(value_);
66 void die_if_unset()
const
70 (*
fatal_error)(
"Accessing value of unset optional");
82 return lhs.is_set() == rhs.is_set() &&
83 (!lhs.is_set() || lhs.value() == rhs.value());
95 return lhs.is_set() && (lhs.value() == rhs);
101 return !(lhs == rhs);
Definition: optional_value.h:27
operator bool() const
Definition: optional_value.h:60
T && consume()
Definition: optional_value.h:53
optional_value(T const &value)
Definition: optional_value.h:30
optional_value & operator=(T const &value)
Definition: optional_value.h:32
bool is_set() const
Definition: optional_value.h:39
T & value()
Definition: optional_value.h:47
T const & value() const
Definition: optional_value.h:41
bool operator==(T const &lhs, optional_value< T > const &rhs)
Definition: optional_value.h:105
bool operator==(optional_value< T > const &lhs, optional_value< T > const &rhs)
Definition: optional_value.h:80
bool operator!=(optional_value< T > const &lhs, T const &rhs)
Definition: optional_value.h:99
bool operator==(optional_value< T > const &lhs, T const &rhs)
Definition: optional_value.h:93
void(* fatal_error)(char const *reason,...)
fatal_error() is strictly for "this should never happen" situations that you cannot recover from.
bool operator!=(T const &lhs, optional_value< T > const &rhs)
Definition: optional_value.h:111
bool operator!=(optional_value< T > const &lhs, optional_value< T > const &rhs)
Definition: optional_value.h:87