Re: template struct question

2025-02-13 Thread WhatMeWorry via Digitalmars-d-learn
Just wanted to thank everybody for their suggestions. Ali's code provided the breakthrough: ```d import std.stdio; void main() { struct HexBoard(F,I) { this(F d, I r, I c) { diameter = d; rows = r; cols = c; } F diameter; I rows; I cols; } void displayHexBoard(HB)(HB h) { w

Re: template struct question

2025-02-13 Thread bkoie via Digitalmars-d-learn
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

Re: template struct question

2025-02-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 12 February 2025 at 20:55:14 UTC, WhatMeWorry wrote: ```d 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

Re: template struct question

2025-02-12 Thread monkyyy via Digitalmars-d-learn
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

Re: template struct question

2025-02-12 Thread Ali Çehreli via Digitalmars-d-learn
On 2/12/25 12:55 PM, WhatMeWorry wrote: > 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 Would isInstanceOf be useful? (Wh

template struct question

2025-02-12 Thread WhatMeWorry via Digitalmars-d-learn
``` 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!(dou