Initializing associative arrays
Stewart Gordon
smjg_1998 at yahoo.com
Tue May 2 09:14:11 PDT 2006
Tydr Schnubbis wrote:
> If I've got this array:
>
> char[][][char[]] arr;
>
> and want to initialize it, what do I do? I couldn't make the
> initializer syntax work, I tried this:
>
> arr = [["key1"]: ["one", "two"]];
<snip>
Problem 1: That isn't an initialiser. An initialiser is what follows
the '=' in a _declaration_.
Problem 2: You've declared the key type as char[]. But you're trying to
use a char[][] as the key.
Problem 3: D doesn't currently support initialisers for AAs. Don't ask
me why - I guess Walter just hasn't got round to putting it in. But
implementing the facility would at least enable this to work:
char[][][char[]] arr = ["key1": ["one", "two"]];
Stewart.
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS-
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------
My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.
More information about the Digitalmars-d-learn
mailing list