[Issue 1878] foreach does not handle integral types appropriately

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 28 16:32:53 PDT 2012


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #2 from bearophile_hugs at eml.cc 2012-10-28 16:32:52 PDT ---
A wider benchmark:


import std.typetuple: TypeTuple;
import std.range: iota;
void main() {
    foreach (T; TypeTuple!(byte, ubyte, short, ushort,
                           int, uint, long, ulong))
        foreach (i; 0 .. cast(T)10)
            pragma(msg, T, "  ", typeof(i));
    pragma(msg, "");
    foreach (T; TypeTuple!(byte, ubyte, short, ushort,
                           int, uint, long, ulong))
        foreach (i; iota(0, cast(T)10))
            pragma(msg, T, "  ", typeof(i));
}


byte  int
ubyte  int
short  int
ushort  int
int  int
uint  uint
long  long
ulong  ulong

byte  int
ubyte  int
short  int
ushort  int
int  int
uint  uint
long  long
ulong  ulong

-- 
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