std.variant, elaborate copying and GC

Yuriy yuriy.glukhov at gmail.com
Tue Apr 8 09:02:58 PDT 2014


Hello, i've been playing around with std.variant and noticed, 
that it does not support elaborate copying, when a struct uses 
one. So the question is whether it is intended or not. If yes, 
std.variant should probably prohibit usage of such structs. If 
no, then it we will need to add a destructor and, and handle 
destruction in std.Variant.handler, which will introduce some 
performance drop.
Also, i can't completely understand how garbage collection works. 
E.g. setting an instance of a class to std.variant will copy its 
reference to variant's internal storage, which is void[]. Will GC 
loose track of such reference? Thanx.


More information about the Digitalmars-d-learn mailing list