how to do iota(0,256) with ubytes ? (cf need for iotaInclusive)

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 12 14:42:54 PDT 2015


On Mon, Oct 12, 2015 at 1:41 PM, Andrei Alexandrescu via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 10/12/15 10:55 PM, Timothee Cour via Digitalmars-d wrote:
>
>> that's only a partial fix:
>> I also would like to express:
>>
>> iotaInclusive(1,256)
>>
>
> iota!ubyte.drop(1)
>
> iotaInclusive(1,256,3)
>>
>
> iota!ubyte.drop(1).stride(3)
>

That's not a good workaround; it's error-prone in more general cases:

auto fun(ubyte a, ubyte stride){
// return iotaInclusive(a,256, stride);// simple
// error prone with your suggestion:
auto b=some function of a, stride;
return iota!ubyte.drop(b).stride(stride);
}



>
> Just playing devil's advocate.
>
>
> Andrei
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20151012/8e319cd8/attachment-0001.html>


More information about the Digitalmars-d mailing list