Linker Error with Template Function

Nick Treleaven nick at geany.org
Tue Sep 13 08:43:45 UTC 2022


On Tuesday, 13 September 2022 at 03:00:17 UTC, Kyle Ingraham 
wrote:
> Any suggestions for being able to call one function for any 
> instance given but maintain flexible return types?

Not sure if it helps, but you can define final methods in an 
interface, which can call virtual interface methods:
```d
interface PathConverter
{
     string getValue();

     final T toD(T)()
     {
         import std.conv : to;

         return to!T(getValue());
     }
}
```
Not tested as AFK.


More information about the Digitalmars-d-learn mailing list