Pattern to accept associative arrays

Steven Schveighoffer schveiguy at gmail.com
Mon Jul 6 11:51:55 UTC 2020


On 7/5/20 4:32 PM, MoonlightSentinel wrote:
> On Sunday, 5 July 2020 at 19:06:47 UTC, Steven Schveighoffer wrote:
>> A more "appropriate" signature would be something like this:
>>
>> void foo(T)(T aa) if (is(T : V[K], K, V))
> 
> This doesn't work as expected because one cannot reference symbols 
> introduced in a template constraint. You would need to redefine K and V 
> inside of foo ...
> 

Noted, but doesn't change the point that you shouldn't be able to 
explicitly set K and V separately from T.

-Steve


More information about the Digitalmars-d mailing list