template struct question
WhatMeWorry
kheaser at gmail.com
Wed Feb 12 20:55:14 UTC 2025
```
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
More information about the Digitalmars-d-learn
mailing list