Use template type in function