Idiomatic way to generate all possible values a static array of ubyte can have
rikki cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Apr 2 01:48:10 PDT 2016
On 02/04/2016 9:36 PM, jkpl wrote:
> On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote:
>> On 02/04/2016 9:20 PM, jkpl wrote:
>>> Let's say I have a ubyte[256]. I want to test all the possible values
>>> this array can have on a function.
>>
>> Actually I'd use a hex string.
>>
>> So:
>> static ubyte[256] DATA = cast(ubyte[256])x"00 01 02 03";
>> I'm sure you get the idea. That can be created easily enough.
>
> No I don't get the idea. I think that I haven't well explained. By
> static array I meant "not dynamic". The 256^256 combinations must be
> generated on the same ubyte[256], which is a variable, during the
> program execution.
Okay that is a problem then.
Stick with generating it I think, can't hard code that number of
combinations.
More information about the Digitalmars-d-learn
mailing list