Initializing assoc array to non-null
d coder
dlang.coder at gmail.com
Sat Jun 1 09:15:26 PDT 2013
Thanks Jonathan
Do you think this could make a good enhancement request?
Regards
- Puneet
On Sat, Jun 1, 2013 at 9:34 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:
> On Saturday, June 01, 2013 20:21:42 d coder wrote:
> > Greetings
> >
> > Is there a way to initialize an associative array to a non-null (but
> still
> > empty) state? The only way I know is by adding an element and then
> removing
> > it. Did I miss something obvious? Basically I want to write lines 7-8 in
> > the following code in a cleaner fashion. Any ideas?
>
> Unfortunately, at the moment, I believe that that's the best that you can
> do -
> though it's trivial enough to write a function that does that for you so
> that
> you can make it a one-liner:
>
> auto aa = initAA!(string[int])();
>
> or
>
> initAA(aa);
>
> - Jonathan M Davis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130601/96ad71c2/attachment.html>
More information about the Digitalmars-d-learn
mailing list