Templated Struct Constructor

Andrew Wiley wiley.andrew.j at gmail.com
Fri Dec 9 23:23:52 PST 2011


Is there a syntax that allows me to specify arguments to a templated
constructor for a struct? The intuitive way looks like this, but it
doesn't work.

---
struct Test {
	this(T, bool b)(T info) if((b && something ) || (!b && somethingElse)) {
		
	}
}

void main() {
	Test test = Test!(int, true)(5); // Error: template instance
Test!(int,true) Test is not a template declaration, it is a struct
}
---


More information about the Digitalmars-d mailing list