Replace function instanciations with macros by templates