The OpenD Programming Language

Annotated

A convenience definition of an annotated value.

A structure that behaves like a recursive algebraic type should define enum _serdeRecursiveAlgebraic; member.

Constructors

this
this(string[] annotations, Args args)

Members

Functions

opCmp
int opCmp(typeof(this) rhs)
opEquals
bool opEquals(Annotated rhs)
value
inout(T) value()
value
T value(T value)

Variables

annotations
string[] annotations;
value
T value;

Examples

auto annotations = ["annotation"];
static struct S {double x;}
auto as = Annotated!S(annotations, 5);
assert(as.annotations == annotations);
assert(as.value.x == 5);

static struct C {double x;}
auto ac = Annotated!S(annotations, 5);
assert(ac.annotations == annotations);
assert(ac.value.x == 5);
import mir.algebraic;
auto annotations = ["annotation"];
static struct S {double x;}
auto as = Annotated!(Variant!S)(annotations, 5);
assert(as.annotations == annotations);
assert(as.value.x == 5);

static struct C {double x;}
auto ac = Annotated!(Variant!S)(annotations, 5);
assert(ac.annotations == annotations);
assert(ac.value.x == 5);

Meta