string[int[][]] ??

dcoder dcoder at devenull.dev
Thu Jul 22 13:57:59 PDT 2010


== Quote from dcoder (dcoder at devnull.com)'s article
> Hello.  I want to use associative arrays, but have a 2-d int array as my
> index.  so something like:
> string[int[][]] chessboard;
> chessboard[[0,0]] = "Rook";
> chessboard[[0,1]] = "Knight";
> Is this possible?  I can declare chessboard without any compiler complaints,
> but I haven't figured out how to assign anything to it.
> Any help would be appreciated.
> thanks!
> dcoder


Ooops, I just realized that int[someX][someY] needs to evaluate to an int, so that
my statement above doesn't make any sense.

Still, is there anyway I can keep the spirit of a double index to a chessboard
without having to create a Coordinate object and define relational orderings?

thanks.

dcoder.



More information about the Digitalmars-d-learn mailing list