What Is Function Template

Posted on

What Is Function Template

Function Templates We write a generic function that can be used for different data types. Examples of function templates are sort(), max(), min(), printArray() .
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 .
A non-template function is not related to a function template, even though the non-template function may have the same name and parameter profile as those of .
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 .
An explicit instantiation definition forces instantiation of the function or member function they refer to. It may appear in the program anywhere after the template .
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 .

Leave a Reply

Your email address will not be published. Required fields are marked *