New hash

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 23 19:39:01 PDT 2012


On Sat, Mar 24, 2012 at 02:39:35AM +0100, Andrej Mitrovic wrote:
> I thought I'd open this topic for discussion of issues with the new
> hash implementation.
[...]

Another issue:

	AA!(string,int[]) aa;
	auto x = aa.get("abc", []);

This fails to compile, because the compiler deduces the type of [] as
void[], and aa.get() doesn't know how to assign void[] to int[].

The problem is that aa.get() is a template function, so the usual
implicit type deduction doesn't work. Here's a reduced version of the
same problem:

	int[] func1(int dummy, int[] x) { return x; }
	int[] func2(T)(T dummy, int[] x) { return x; }
	void main() { 
		auto x = func1(1, []);	// OK: [] deduced as int[]
		auto y = func2(1, []);	// Error: [] deduced as void[],
					// no matching templates found.
	}


T

-- 
Береги платье снову, а здоровье смолоду. 


More information about the Digitalmars-d mailing list