D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2669 - Variant does not have opApply or another iteration mechanism
Summary: Variant does not have opApply or another iteration mechanism
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-15 12:26 UTC by Andrei Alexandrescu
Modified: 2014-02-14 20:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-02-15 12:26:03 UTC
Credit due to Chris Nicholson-Sauls.
Comment 1 Walter Bright 2009-03-14 20:57:15 UTC
I think this means std.variant in Phobos.
Comment 2 Neia Neutuladh 2009-03-14 21:16:47 UTC
It might be worthwhile to examine the following:
http://dsource.org/projects/dmocks/browser/dunit/trunk/dunit/assertions/variant.d
http://dsource.org/projects/dmocks/browser/dunit/trunk/dunit/assertions/variant_array.d

The former defines yet another Variant; the latter defines a VariantArray that allows iteration as if it were an array of Variants.

This only applies to dynamic and static arrays; it doesn't apply to associative arrays.

They also reference my runtime traits module, linked for completeness:
http://dsource.org/projects/dmocks/browser/reflect/reflect/RuntimeTraits.d
Comment 3 Andrei Alexandrescu 2009-08-27 14:27:32 UTC
I implemented a rather limited opApply for now, but I'll keep this open while I think of a better solution.
Comment 4 Andrei Alexandrescu 2010-09-26 13:34:33 UTC
Fixed:

http://www.dsource.org/projects/phobos/changeset/2059