BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
8 # pragma warning(disable:4521)
9 # pragma warning(disable:4522)
31 if( o._valid )
new (ptr()) T( *o );
38 if( o._valid )
new (ptr()) T( *o );
45 if( o._valid )
new (ptr()) T( std::move(*o) );
54 if( o._valid )
new (ptr()) T( *o );
73 if( o._valid )
new (ptr()) T( std::move(*o) );
82 new ((
char*)ptr()) T( std::forward<U>(u) );
89 new (ptr()) T( std::forward<U>(u) );
97 if( _valid && o._valid ) {
99 }
else if( !_valid && o._valid ) {
111 if( _valid && o._valid ) {
113 }
else if( !_valid && o._valid ) {
125 if( _valid && o._valid ) {
127 }
else if( !_valid && o._valid ) {
139 if( _valid && o._valid ) {
141 }
else if( !_valid && o._valid ) {
156 if( _valid && o._valid )
158 ref() = std::move(*o);
160 }
else if ( !_valid && o._valid ) {
161 *
this = std::move(*o);
173 if( _valid && o._valid )
175 ref() = std::move(*o);
177 }
else if ( !_valid && o._valid ) {
178 *
this = std::move(*o);
186 bool valid()
const {
return _valid; }
191 explicit operator bool()
const {
return _valid; }
194 const T&
operator*()
const { assert(_valid);
return ref(); }
216 return a.
valid() < b.valid();
234 T& ref() {
return *ptr(); }
235 const T& ref()
const {
return *ptr(); }
236 T* ptr() {
void* v = &_value[0];
return static_cast<T*
>(v); }
237 const T* ptr()
const {
const void* v = &_value[0];
return static_cast<const T*
>(v); }
240 #if defined(_MSC_VER)
241 double _value[((
sizeof(T)+7)/8)] __declspec((align(16)));
243 double _value[((
sizeof(T)+7)/8)] __attribute__((aligned(16)));
250 return (!left == !right) || (!!left && *left == *right);
252 template<
typename T,
typename U>
254 return !!left && *left == u;
258 return (!left != !right) || (!!left && *left != *right);
260 template<
typename T,
typename U>
262 return !left || *left != u;
266 # pragma warning(pop)
const T * operator->() const
bool assert_optional(bool is_valid)
optional & operator=(optional &o)
optional(const optional< U > &o)
optional(optional< U > &&o)
optional & operator=(optional &&o)
optional & operator=(const optional &o)
optional(const optional &o)
optional & operator=(std::nullptr_t)
friend bool operator<(const optional a, optional b)
optional & operator=(const optional< U > &o)
optional & operator=(U &&u)
bool operator!=(const optional< T > &left, const optional< T > &right)
optional(optional< U > &o)
optional & operator=(optional< U > &o)
provides stack-based nullable value similar to boost::optional
const T & operator*() const
bool operator==(const optional< T > &left, const optional< T > &right)
optional & operator=(optional< U > &&o)
friend bool operator==(const optional a, optional b)