The OpenD Programming Language

AnnotatedOnce

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 annotation, Args args)

Members

Functions

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

Variables

annotation
string annotation;
value
T value;

Examples

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

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

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

Meta