Re: Template + alias + basic type depends on another parameter = broken?

2023-02-22 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 22 February 2023 at 20:20:46 UTC, Dark Hole wrote: ```d template Foo(T, alias T[] Array) { // ... } // ... Bar[] arr; Foo!(Bar, arr); ``` This is valid D, but it doesn't work. It gives error "Error: template instance `Foo!(Bar, arr)` does not match template declaration

Template + alias + basic type depends on another parameter = broken?

2023-02-22 Thread Dark Hole via Digitalmars-d-learn
I'm trying to rewrite really old D code. There was fragment like that: ```d template Foo(T, T[] Array) { // ... } // ... Bar[] arr; Foo!(Bar, arr); ``` This gives error `can't read arr in compile time`. Small changes: ```d template Foo(T, alias T[] Array) { // ... } // ... Bar[] arr;

Re: importC - how to use more effectively?

2023-02-22 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 22 February 2023 at 15:00:56 UTC, WebFreak001 wrote: I just first time used importC in a prototype project I just worked on. I used it to just import `libevdev.h` on linux to register a custom input device / make a simple userspace input driver. A suggestion: try tcc as

importC - how to use more effectively?

2023-02-22 Thread WebFreak001 via Digitalmars-d-learn
I just first time used importC in a prototype project I just worked on. I used it to just import `libevdev.h` on linux to register a custom input device / make a simple userspace input driver. Now libevdev comes with two header files: libevdev.h and libevdev-uinput.h Q1) Since

Re: How to get only the field name from an alias?

2023-02-22 Thread Elfstone via Digitalmars-d-learn
On Tuesday, 21 February 2023 at 12:32:51 UTC, Adam D Ruppe wrote: On Tuesday, 21 February 2023 at 02:41:34 UTC, Elfstone wrote: apparently F.stringof You almost never want to use .stringof, instead try __traits(identifier, F) and see what it gives you. Alternatively, loop over