Indexed foreach on struct?

Matt Soucy msoucy at csh.rit.edu
Mon Jan 23 12:32:07 PST 2012


So I was messing around with some code I've been writing recently, and I 
wanted to use a foreach on a struct as if it were an associative array. 
The problem is, I can't find any information on how to do that.
I can't use something like "alias this", because the class I'm writing 
acts as a wrapper that lets me use string offsets for something that's 
not string-indexed by default, so there's nothing to alias it TO.
I don't see any sort of opApply or similar to do this, and the foreach 
section of dlang.org doesn't help. Is there a way to do it, or do I need 
to do a workaround?
Thank you,
-Matt Soucy


More information about the Digitalmars-d-learn mailing list