On Sunday, 5 July 2020 at 21:06:32 UTC, Per Nordlöw wrote:
Is there a way to construct a custom written hash-table container (struct) from an AA-literal expression?

I think your best bet is a tuple of pairs, because then you're not limited to compile time values, but it won't look pretty:

import std;

struct Pair
{
    string key;
    int value;
}

void main() @nogc
{
    auto a = tuple(Pair("foo", 1), Pair("bar", 2));
}

--
/Jacob Carlborg

Reply via email to