Re: Error: template instance does not match template declaration

2021-11-17 Thread Vitalii via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 18:00:59 UTC, Steven Schveighoffer wrote: On 11/17/21 7:55 AM, Vitalii wrote: [...] Template parameters are of 3 types: 1. A type parameter. This has a single symbol name, and represents a type *provided by the caller*. [...] Steve, thank you very much

Re: Error: template instance does not match template declaration

2021-11-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/17/21 7:55 AM, Vitalii wrote: Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. Template parameters are of 3 types: 1. A type

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 12:55:15 UTC, Vitalii wrote: Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. The following code compiles

Re: Error: template instance does not match template declaration

2021-11-17 Thread Vitalii via Digitalmars-d-learn
Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. The following code compiles successfully, but return *"fun with unknown"* instead of *"fun

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 12:19:05 UTC, Tejas wrote: On Wednesday, 17 November 2021 at 10:10:43 UTC, Vitalii wrote: Hello! I am getting the following error: ``` inst.d(8): Error: template instance `Worker!(Mode.Inspect)` does not match template declaration `Worker(mode : Mode) ```

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 10:10:43 UTC, Vitalii wrote: Hello! I am getting the following error: ``` inst.d(8): Error: template instance `Worker!(Mode.Inspect)` does not match template declaration `Worker(mode : Mode) ``` when compile next code: ``` enum Mode { Inspect, Execute }

Error: template instance does not match template declaration

2021-11-17 Thread Vitalii via Digitalmars-d-learn
Hello! I am getting the following error: ``` inst.d(8): Error: template instance `Worker!(Mode.Inspect)` does not match template declaration `Worker(mode : Mode) ``` when compile next code: ``` enum Mode { Inspect, Execute } class Worker(mode : Mode) { this() {} } void main() {

Re: Error: template instance does not match template declaration

2016-03-30 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 18:29:27 UTC, Ali Çehreli wrote: So, dict is a template value parameter of type T[string]. I don't think you can use an associative array as a template value parameter. (Can we?) Found this in D language reference:

Re: Error: template instance does not match template declaration

2016-03-29 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 18:29:27 UTC, Ali Çehreli wrote: On 03/29/2016 11:21 AM, ref2401 wrote: So, dict is a template value parameter of type T[string]. I don't think you can use an associative array as a template value parameter. (Can we?) However, it is possible to use anything as

Re: Error: template instance does not match template declaration

2016-03-29 Thread Ali Çehreli via Digitalmars-d-learn
On 03/29/2016 11:21 AM, ref2401 wrote: > private void impl(S, T, T[string] dict)(S arg) { > writeln("S: ", S.stringof); > writeln("T: ", T.stringof); > writeln("dict: ", dict); So, dict is a template value parameter of type T[string]. I don't think you can use an associative

Error: template instance does not match template declaration

2016-03-29 Thread ref2401 via Digitalmars-d-learn
OS: Win 8.1 Pro DMD: v2.070.0 cmd: dmd main.d -ofconsole-app.exe -debug -unittest -wi Code is successfully compiled until I uncomment test1 function call in the main. If it's uncommented I get the following compile-time error: main.d(58): Error: template instance impl!(string, bool,