[Issue 10466] New: Optional "[]" syntax for std.range.iota too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 24 14:01:53 PDT 2013


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

           Summary: Optional "[]" syntax for std.range.iota too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-24 14:01:52 PDT ---
There are _many_ situations where you want to iterate on a full range of an
integral value using iota, and you want the iteration variable to be of that
type.

Unfortunately this doesn't iterate on the last value:

iota(ubyte.min, ubyte.max)

And this doesn't yield ubytes:

iota(ubyte.min, ubyte.max + 1)

So a simple solution comes copying from std.random.uniform, using the optional
"[]" syntax:

iota!"[]"(ubyte.min, ubyte.max)

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