Template Instantiation In and of itself, the template does nothing When the compiler encounters a template it stores the template but doesnt generate any machine instructions or codes When a function template is instantiated Compiler finds type parameters in list of function template For each type in the function parameter list, type of corresponding argument is determined These two function type and argument type are then bound together E.g., when it encounters a call to swap ( EXample: swap(int, int)i it generates an integer instance of swap() The type will be determined by the compiler (at compilation time from the type of the arguments passed when swap() is called Cannot specify plata type at run time Static binding!Template Instantiation ▪ In and of itself, the template does nothing ▪ When the compiler encounters a template • it stores the template • but doesn't generate any machine instructions or codes ▪ When a function template is instantiated • Compiler finds type parameters in list of function template • For each type in the function parameter list, type of corresponding argument is determined • These two function type and argument type are then bound together ▪ E.g., when it encounters a call to swap() • Example: swap(int, int); • it generates an integer instance of swap() ▪ The type will be determined … • by the compiler (at compilation time) • from the type of the arguments passed when swap() is called ▪ Cannot specify data type at run time! Static binding!