20 #ifndef GALOIS_OPTIONAL_H
21 #define GALOIS_OPTIONAL_H
25 #include "galois/config.h"
38 void construct(
const T& val) {
43 void assign_impl(
const T& val) { get_impl() = val; }
52 T& get_impl() {
return data_.get(); }
53 const T& get_impl()
const {
return data_.get(); }
60 optional(
const T& val) : initialized_(false) { construct(val); }
64 construct(rhs.get_impl());
77 assign_impl(rhs.get_impl());
82 construct(rhs.get_impl());
90 assign_impl(rhs.get_impl());
95 construct(rhs.get_impl());
113 template <
typename U>
125 assert(initialized_);
128 const T&
get()
const {
129 assert(initialized_);
135 assert(initialized_);
139 assert(initialized_);
void assign(const optional< U > &rhs)
Definition: optional.h:87
optional()
Definition: optional.h:58
Single (uninitialized) object with specialization for void type.
Definition: LazyObject.h:71
optional(const optional< U > &rhs)
Definition: optional.h:68
optional & operator=(const optional< U > &rhs)
Definition: optional.h:114
optional & operator=(const optional &rhs)
Definition: optional.h:108
bool is_initialized() const
Definition: optional.h:106
optional(const T &val)
Definition: optional.h:60
optional(const optional &rhs)
Definition: optional.h:62
T & operator*()
Definition: optional.h:132
~optional()
Definition: optional.h:72
void assign(const T &val)
Definition: optional.h:99
Galois version of boost::optional.
Definition: optional.h:34
const T & operator*() const
Definition: optional.h:133
bool(optional::* unspecified_bool_type)() const
Definition: optional.h:56
optional & operator=(const T &val)
Definition: optional.h:119
void assign(const optional &rhs)
Definition: optional.h:74
T * operator->()
Definition: optional.h:134
const T * operator->() const
Definition: optional.h:138