What Is Template Function

Posted on

What Is Template Function

Function Templates We write a generic function that can be used for different data types. Examples of function templates are sort(), max(), min(), printArray() .
A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and algorithms are examples of generic .
Function template defines a general set of operations that will be applied to various types of data. The type of data that the function will operate upon is passed to .
Templates are powerful features of C++ which allows you to write generic programs. In simple terms, you can create a single function or a class to work with .
A non-template function is not related to a function template, even though the nontemplate function may have the same name and parameter profile as those of .
C++ provides two kinds of templates: class templates and function templates. Use function templates to write generic functions that can be used with arbitrary .