Variant

A type which can contain any type in the language, stored on the heap.

Note: The ownership of a variant depends on the API, the Variant itself does not own its memory. You may call the free method to free any memory owned by the variant.

Constructors

this
this(T value)

Constructor

Alias This

isInitialized

Members

Functions

free
void free()

Frees the memory stored in the variant.

get
T get()

Gets the content of the variant.

has
bool has()

Gets whether the variant contains the given type.

opAssign
void opAssign(T value)

Allows assigning the variant to a value.

opEquals
bool opEquals(T other)

Gets whether the variant is the same as another variant.

tryGet
Option!T tryGet()

Tries to get the content of the variant.

Manifest constants

empty
enum empty;

An empty variant.

Properties

isEmpty
bool isEmpty [@property getter]

Whether the variant is empty.

isInitialized
bool isInitialized [@property getter]

Whether the variant has data.

Meta