Access derived type in baseclass static function template
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 2 05:49:12 PDT 2017
On 8/2/17 8:07 AM, Timoses wrote:
> Hey,
>
> wondering whether it's possible to access the derived type from a
> function template in the base class or interface.
>
> this T does not seem to be working, I guess because it's a static
> function and this does not exists?!
Yep.
> Any way I could accomplish this?
Move test outside the interface:
void test(C)(C c) if(is(C : I))
{
writeln(C.type.stringof);
}
Though, at that point, you don't need I. I'm assuming you have a more
complex real-world example.
-Steve
More information about the Digitalmars-d-learn
mailing list