On Wednesday, 12 February 2025 at 20:55:14 UTC, WhatMeWorry wrote:
```
void main()
{

struct HexBoard(F,I)
{
    this(F d, I r, I c) {}
//void displayHexBoard(HexBoard!(F,I) h) {} // this compiles fine!
}

void displayHexBoard(HexBoard!(F,I) h) {} // error undefined identifier F and I


auto h1 = HexBoard!(float,uint)(.25, 3, 7);
auto h2 = HexBoard!(double,int)(.3, 5, 5);

}


Is there any clever way to move the method outside of a templated block structure? Or is this as good as it gets.

I tried
// Explicit instantiation for 'int' type
//int add!(int, int);
void displayHexBoardData(HexBoard2!(float,uint) h); // declaration

but that just returns
Error: declaration `displayHexBoard` is already defined
onlineapp.d(10): `function` `displayHexBoard` is defined here

```d
import std.stdio;

struct Foo(T, L) { T t; L l; }
void display(T, L)(Foo!(T, L) f) { f.writeln; }

alias FooIntD = Foo!(int, double);
void main() { auto f = FooIntD(10, 20.3); f.display; }
```

Reply via email to