digitalmars.D - Templated Struct Constructor
- Andrew Wiley (14/14) Dec 09 2011 Is there a syntax that allows me to specify arguments to a templated
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 } ---
Dec 09 2011