template matching for associative arrays

David B. Held dheld at codelogicconsulting.com
Sun Apr 1 21:56:40 PDT 2007


PNoel wrote:
> [...]
> .. doesn't work. But this does:
> class SomeClass(K, V, M : K[V])
> {
> }
> .. but this way you have to know the key and value type in advance
> which doesn't help to make the code "better".
> 
> Is there a library function to accomplish this or at least a map type decomposition to key/value types?

I'm no expert on D template syntax, but perhaps you could try this:

class SomeClass(M: K[V], K, V)
{
     ....
}

Dave


More information about the Digitalmars-d-dtl mailing list