this T / variadic template and interfaces

frame frame86 at live.com
Mon Oct 26 12:00:47 UTC 2020


On Monday, 26 October 2020 at 11:48:48 UTC, Simen Kjærås wrote:
> 
>
> This makes sense if you consider that the user of the interface 
> has no knowledge of the types that implement it, and vice 
> versa: the implementing class has no idea which instantiations 
> to make, and the user has no idea which implementing classes to 
> create instantiations for. Templates require that the user have 
> full knowledge of the templates to be instantiated.
>
> There are some workarounds of sorts, but they depend heavily on 
> what you're trying to achieve. Can you use an array of 
> std.variant.Variant, for instance?
>
> --
>   Simen

Yes, the user/coder does not know of other types by any chance. 
The interface must be used.

Well I guess I let the interface do the variadic stuff and pass 
the argument as Variant[] to the wrapper in a new interface 
method. Thanks.



More information about the Digitalmars-d-learn mailing list