Is there an equivavlent to C# boxing in D?
nise at nise.com
Sat Feb 12 00:27:34 UTC 2022
If you want to store a value type on the heap in D you just use
"new" and a pointer to the type. The same thing in C# would be to
wrap the value type into an object. However when you do that
automatic conversion without a cast seems not to be possible (C#
also have a dynamic type that might solve that but more heavy
Is there a possibility to wrap a value type in D around the base
object class that is otherwise used as the class reference type?
Would this be a way to use D without raw pointers for heap
allocated value types?
More information about the Digitalmars-d-learn