Thread overview | |||||
---|---|---|---|---|---|
|
March 10, 2005 [Associative arrays (AA)] static initializers | ||||
---|---|---|---|---|
| ||||
Are they feasible in foreseeable future? int[char[]] m = { "one":1, "two":2 }; char[][int] m = { 1:"one", 2: "two" }; It could be extremely nice to have them... ( keeeping also in mind Matthew's enum2str implementation ) I think that they could be implemented internally as sorted (at compile time) key/value pairs with binary search lookup. As far as I can see they fit in grammar without any changes. Andrew Fedoniouk. http://terrainformatica.com |
March 10, 2005 Re: [Associative arrays (AA)] static initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Fedoniouk | Would be very useful for any quick and (not too) dirty hacks/utilities
what I usually have to write.
I impatiently look forward for all the static array initialization solutions.
Tamas Nagy
>Are they feasible in foreseeable future?
>
>int[char[]] m = { "one":1, "two":2 };
>char[][int] m = { 1:"one", 2: "two" };
>
>It could be extremely nice to have them...
>( keeeping also in mind Matthew's enum2str
>implementation )
>
>I think that they could be implemented
>internally as sorted (at compile time) key/value pairs
>with binary search lookup.
>
>As far as I can see they fit
>in grammar without any changes.
>
>Andrew Fedoniouk.
>http://terrainformatica.com
|
March 11, 2005 Re: [Associative arrays (AA)] static initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Fedoniouk | Andrew Fedoniouk wrote: > Are they feasible in foreseeable future? > > int[char[]] m = { "one":1, "two":2 }; > char[][int] m = { 1:"one", 2: "two" }; > > It could be extremely nice to have them... > ( keeeping also in mind Matthew's enum2str > implementation ) <snip> Been brought up before: http://www.digitalmars.com/drn-bin/wwwnews?D/26695 Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation