template <typename T>

class Maybe

Defined at line 34 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

Maybe

<T

> is similar to, but much more restricted than, C++17's std::optional.

It is intended for use in Emboss's expression system, wherein a non-Known()

Maybe

<T

> will usually (but not always) poison the result of an operation.

As such, Maybe

<

> is intended for use with small, copyable T's: specifically,

integers, enums, and booleans. It may not perform well with other types.

Public Methods

void Maybe<T> ()

Defined at line 36 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

void Maybe<T> (T value)

Defined at line 37 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

void Maybe<T> (const Maybe<T> & )

Defined at line 39 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

void ~Maybe<T> ()

Defined at line 40 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

Maybe<T> & operator= (const Maybe<T> & )

Defined at line 41 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

Maybe<T> & operator= (T value)

Defined at line 42 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

Maybe<T> & operator= (const T & value)

Defined at line 47 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

bool Known ()

Defined at line 53 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

T Value ()

Defined at line 54 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

T ValueOr (T default_value)

Defined at line 58 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h

T ValueOrDefault ()

A non-Ok() Maybe value-initializes value_ to a default (by explicitly

calling the nullary constructor on value_ in the initializer list), so it

is safe to just return value_ here. For integral types and enums, value_

will be 0, for bool it will be false, and for other types it depends on the

constructor's behavior.

Defined at line 66 of file ../../third_party/github.com/google/emboss/src/runtime/cpp/emboss_maybe.h