Idiomatic way to generate all possible values a static array of ubyte can have

jkpl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 2 01:36:11 PDT 2016


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.


More information about the Digitalmars-d-learn mailing list