template recursion

Alex sascha.orlov at gmail.com
Tue Jun 26 09:35:34 UTC 2018


Hi all,
I have a strange case of template recursion, which I don't know 
how to solve:

´´´
import std.range;

void main()
{
	T.member.tarr.length = 42;
	//put(T.member, 4); // line 6
	T.member.put(4); // line 7
}


struct T
{
	void put(Type)(Type t){} // line 13

	static B member;
}

struct B
{
	T[] tarr;
	void put(Type)(Type t)
	{
		put(tarr[t], t); // line 23
	}
}
´´´

Line 7 complains about:
template app.B.put cannot deduce function from argument types 
!()(T, int)

So, I see, that the compiler tries to use the same put function 
in line 23, as in line 7 and fails. Instead of this, I want to 
use the one in line 13.
But I don't see any mistake at line 23...

Besides this, as a secondary question:
using line 6 does not yield any helpful debugging message. My put 
functions are templates and pretty long and branching, and I'm 
trying to debug them somehow, but using idiomatic writing all I 
get as a message is something like
"Cannot put a XX into a YY." :(




More information about the Digitalmars-d-learn mailing list