How do I get the expected return type of a polymorphic function at compile time?

Presumably (from the code) the value is irrelevant, since it is overwritten, the key is calculating the type T.

This approach can be extended to pre-allocated buffers if applied twice (inner-outer, just guess a buffer type and get a new one if guessed wrong, doing it in each iteration), but I need to think about how to package and simplify this.

1 Like