Get return type of a template function without instantiating it
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 22 04:58:25 PST 2016
On Tuesday, 22 November 2016 at 12:21:18 UTC, Yuxuan Shui wrote:
> Is there a way to get a template function return type with
> instantiating it? The return type is independent of the
> template arguments.
>
> I'm asking because there's potentially recursive template
> instantiation if I do try to instantiate it.
Do you control the template in question's source? If so you could
have a degenerate template type (e.g. MyTemplate!void ) that just
returns the correct types .init
Otherwise i'm not sure you can because IIRC std.traits.ReturnType
requires an instantiated symbol.
More information about the Digitalmars-d-learn
mailing list