nxt.variant_ex

Lightweight versions of polymorphism packed inside one single word/pointer.

Most significant bits are used to store type information.

These higher bits are normally unused on 64-bit systems (tested on Linux). 16 higher bits are, on Linux, either 1 (kernel-space) or 0 (user-space).

Members

Aliases

Sample
alias Sample = WordVariant!(S, T)
Undocumented in source.

Structs

S
struct S
Undocumented in source.
T
struct T
Undocumented in source.
VariantPointerTo
struct VariantPointerTo(Types...)

A typed pointer to a variant of Types, packed into a word (size_t).

WordVariant
struct WordVariant(Types...)

A variant of Types packed into a word (size_t).

See Also

http://forum.dlang.org/post/sybuoliqhhefcovxjfjv@forum.dlang.org

TODO: Ask forum.dlang.org: Is it safe to assume that typeBits most significant bits of a pointer are zero? If not put them in least significant part.

TODO: What todo with the fact that the GC will fail to scan WordVariant? Can the GC be tweaked to mask out the type bits before scanning?

TODO: Enable support for is null instead of isNull?

TODO: Use enforce() instead of assert() in WordVariant:initialize()

TODO: Move to Phobos std.variant

Meta