On Tuesday, 25 January 2022 at 00:23:40 UTC, forkit wrote:

another example:

output is:
typeA:
        100000001:[0, 0, 1, 1, 1, 1, 1, 1]
        100000002:[0, 0, 0, 1, 1, 1, 1, 1]
typeB:
        100000005:[0, 0, 0, 0, 0, 0, 1, 1]
        100000003:[0, 0, 0, 0, 1, 1, 1, 1]
        100000004:[0, 0, 0, 0, 0, 1, 1, 1]


// --

module test;

import std;

void main()
{
    auto aaTable2 =
      ([
       "typeA" : [ 100000001 : [0, 0, 1, 1, 1, 1, 1, 1],
                   100000002 : [0, 0, 0, 1, 1, 1, 1, 1] ],
       "typeB" : [ 100000003 : [0, 0, 0, 0, 1, 1, 1, 1],
                   100000004 : [0, 0, 0, 0, 0, 1, 1, 1],
                   100000005 : [0, 0, 0, 0, 0, 0, 1, 1] ]
                 ]);

    foreach (topLevelKey, topLevelValue; aaTable2.byPair)
    {
        writefln("%s:", topLevelKey);

        foreach(key, value; topLevelValue)
        {
            writefln("\t%s:%s", key, value);
        }
    }

}

//--



Reply via email to