VariantPointer

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 20 06:41:27 PDT 2016


At

https://github.com/nordlow/phobos-next/blob/master/src/variant_pointer.d

I've implemented a pointer-only version of Variant called 
VariantPointer.

I plan to use it to construct light-weight polymorphism in trie 
containers for D I'm currently writing.

VariantPointer uses the top N-bits (N currently 8) to encode the 
type pointed to be the untyped-pointer encoded in the 64-N bits 
lower bits.

My question is:

It safe to assume that `typeBits` most significant bits of a 
pointer on a 64-bit system are always zero?

Note that I didn't want to use the lower bits because I'm 
currently unsure whether I need to represent stack-pointers 
aswell.


More information about the Digitalmars-d-learn mailing list