[Issue 3744] __traits getMember error in checking of second argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 28 21:35:04 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3744



--- Comment #7 from iorlas <denis.tomilin at gmail.com> 2010-01-28 21:35:03 PST ---
(In reply to comment #6)
> Actually, there's nothing at all wrong with __traits(getMember).
> Really, you are asking for static foreach: given a compile-time constant array,
> iterate over each of its members.
> Since static foreach is unfortunately not going to happen (it was on Andrei's
> list, but Walter rejected it), the other possibilities are to make
> __traits(allMembers) into a tuple, or to use the static foreach workaround:
> 
> Something like:
> 
> enum a = __traits(allMembers, ...)'
> foreach(T, int indx; ForEachTuple!(a.length))
> {
>    a = __traits(getMember, a[indx]);
> }

Ok, good idea. But i cannot find a "ForEachTuple" template. Static version of
foreach might be help in this sitiation, but i dunno how to do it. Cuz if i use
normal foreach with this hack(using enum and index for getting a name of
member) a have one same error:
Error: string expected as second argument of __traits getMember instead of
a[indx]. =/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list