Struct template instancing inside of class failed

Denis Feklushkin feklushkin.denis at gmail.com
Sat May 3 09:11:47 UTC 2025


On Friday, 2 May 2025 at 23:15:24 UTC, H. S. Teoh wrote:
>
> Try `S!(this.field)(777)` maybe?

I tried it - nothing changes

> In any case, passing a class-local variable via an alias into a 
> template parameter that tries to access it from inside a 
> function seems rather dangerous and needlessly complex.  Why 
> not just pass the value directly, or a reference/pointer to the 
> variable?

This is a reduced example

IRL I need to pass some handler into methods and destructors of 
the structures that are stored in the array in class Test. There 
is no point in storing it in each instance of the structure - it 
is the same for all structures in the array.

(Yes, of course I can write workarounds for all this, but I 
wanted to write this code idiomatically)



More information about the Digitalmars-d mailing list