Best way to duplicate an associative array

pragma pragma_member at pathlink.com
Thu Mar 23 08:00:48 PST 2006


In article <dvufh2$1e9l$1 at digitaldaemon.com>, Jarrett Billingsley says...
>
>"Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
>news:dvuba7$196f$1 at digitaldaemon.com...
>
>Actually, this is simpler and may be faster (not sure):
>
>template dup(T)
>{
> T dup(T aa)
> {
>  T aa2;
>
>  foreach(key, value; aa)
>   aa2[key] = value;
>
>  return aa2;
> }
>}

Its likely faster as you're not performing a lookup on 'aa' twice per loop.

- EricAnderton at yahoo



More information about the Digitalmars-d mailing list