Implicit fn template instantiation
BCS
BCS_member at pathlink.com
Thu Mar 23 19:07:08 PST 2006
In article <dvvk0i$2tum$1 at digitaldaemon.com>, anthony.difranco at yale.edu says...
>
>Can someone explain why I can't instantiate this template implicitly andor
>comment on whether I'm overlooking a better way to accomplish what this template
>does?
>
>template increment(T, K)
>{
>void increment(T[K] association, K key)
>{
>if(key in association)
>{
>association[key]++;
>}
>else
>{
>association[key] = 1;
>}
>}
>}
>
>Thanks,
>Anthony
>
>
IIRC
if(T* val = (key in association))
(*val)++;
else
association[key]=1;
haven't tried it but it should work
More information about the Digitalmars-d
mailing list