how to do iota(0,256) with ubytes ? (cf need for iotaInclusive)
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 12 15:01:58 PDT 2015
On 10/12/2015 10:51 PM, Nordlöw wrote:
> On Monday, 12 October 2015 at 20:39:11 UTC, Andrei Alexandrescu wrote:
>>> Alexandrescu wrote:
>>>> We can add iota!T() with no arguments that spans the entire range of T
>>>> (integral). -- Andrei
>
> From a quick glance I couldn't find a way to reuse the existing
> overloads. Can anybody come with a reusing solution?
auto iota(T)(){
import std.range;
return chain(iota(T.min,T.max),only(T.max));
}
void main(){
import std.stdio;
writeln(iota!byte());
writeln(iota!dchar());
}
More information about the Digitalmars-d
mailing list