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
struct foo(T){}
void bar(T)(foo!T){}
unittest{
bar(foo!int());
bar(foo!float());
}
```
it can be inferred at the call site, but template arguments must
still be declared