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
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
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
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
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)
```
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 }
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() {
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:
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
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
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,
11 matches
Mail list logo