How can I create (and update) and associative array where the key is a string, and the value is a dynamic array of integers?

For example:

void insertValue( int[][string]aa, string key, int value )
{
    int[]* keyvalue;

    keyvalue = ( key in aa );
    if ( keyvalue !is null )
    {
        *(keyvalue) ~ value;   // This line fails.
    }
    else {
        int[] tmp;
        tmp ~= value;
        aa[key] = tmp;
    }
}


int main( string[] args) {

    int[][string] myAA;

    insertValue( myAA, "hello", 1 );
    insertValue( myAA, "goodbye", 2 );
    insertValue( myAA, "hello", 3 );

    return 0;
}

Fails with:
...(16): Error: ~ has no effect in expression (*keyvalue ~ value)

Thanks for any help.

Reply via email to