On Saturday, 14 May 2016 at 12:25:30 UTC, Lodovico Giaretta wrote:
I wrote this small module (
https://github.com/lodo1995/polymorph.d ), taking inspiration
from Amaury Sechet's great talk at DConf (
http://dconf.org/2016/talks/sechet.html ).
Somewhat related are my lightweight variant implementations
- `WordVariant` at
https://github.com/nordlow/phobos-next/blob/master/src/variant_ex.d#L49
and
- `VariantPointerTo` at
https://github.com/nordlow/phobos-next/blob/master/src/variant_ex.d#L258
They both use the upper bits of a word (currently 64-bit only)
for type-information. See the unittest for details on usage.
The `WordVariant` was needed in my implementation of a
high-performance and memory efficient pure D implementation of
prefix-trie at
https://github.com/nordlow/phobos-next/blob/master/src/trie.d
It will provide flexible use of memory, either using the GC or
not. It's also, when possible, always @safe pure nothrow.
The trie is very much in development right now, but I will
announce its presence as soon as it stabilizes.