this T / variadic template and interfaces

frame frame86 at
Mon Oct 26 11:14:47 UTC 2020

Did not find this topic:

I have an interface and some wrapper classes that use it. The 
wrapper's methods should accept variadic arguments. The runtime 
should only work with the interface, trying casting to a wrapper 
is not an option, because it's a plugin design.

- defining a variadic template in wrapper does not work, because 
we are working with the interface only and compiler complains 
method is not callable with argument X

- defining a variadic template without body in interface causes 
linker errors, which makes sense somehow

- defining a variadic template with body in interface could work 
if the compiler would get the right "this" type but sadly, "this" 
refers to interface and also "this T" refers to interface too.

Is there any way to get this working? I know, I could use a known 
object to feed the arguments and use that instead - but I want to 
keep things simple as possible.

More information about the Digitalmars-d-learn mailing list