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.

What you want cannot work in the general case. The template function must be instantiated.

T identity(T)(T t)
{
    return t;
}

It's not possible to calculate the type of the return value of `identity` until it is instantiated with a type.

Reply via email to