Friday, October 29, 2010

FUNCTION TEMPLATE-SORTING



A function template behaves like a function except that the template can have arguments of many different types (see example). In other words, a function template represents a family of functions. For example, the C++ Standard Library contains the function template max(x, y) which returns either x or y, whichever is larger. max() could be defined like this, using the following template:

In the first two cases, the template argument T is automatically deduced by the compiler to be int and double, respectively. In the third case deduction fails because the type of the parameters must in general exactly match the template arguments. This function template can be instantiated with any copy-constructible type for which the expression (y < href="http://en.wikipedia.org/wiki/Operator_overloading" title="Operator overloading">overloaded.

----------------------------------------------------------------------------------------------

A C++ PROGRAM TO IMPLEMENT SORTING BY USING FUNCTION TEMPLATES

COMPILER EMPLOYED: DEV C++ COMPILER-4.9.9.2

SOURCE FILE SIZE :3 kb

EXE FILE SIZE :580 kb

NOTE: PLEASE INCLUDE THE DESIRED HEADER FILE

---------------------------------------------------------------------------------------------

C++ PROGRAM SOURCE & EXE DOWNLOAD:

Click download button to download

DISCLAIMER: The following program cannot be ensured of perfection.so any flaws in the program can be notified in the comments section.

----------------------------------------------------------------------------------------------
Your's friendly,

[MOHANRAM.G],
ADMIN...

0 comments:

Post a Comment