Parsing is one good place to start. Yes, cast<T> can be a good place to look,
Another important thing is how the template functions should be represented in the application. I think they have to be restricted to use the generic calling convention, as it will allow the implementation to get the correct type for the arguments based on the defined template instance.
Whenever the compiler comes across the use of a template function, it must check generate a template instance with the correct type. For this you can take a look at how template instances are generated for template classes.