answersLogoWhite

0


Best Answer

Function templates are generic functions for which at least one argument must be a generic type. You cannot instantiate a generic type without knowing its actual type, so until you provide an actual type for the function, the function template cannot be instantiated. You provide an actual type simply by calling the function. If an unambiguous template exists, the compiler generates the actual function for you. At that point the function is said to have been instantiated, just as if you'd written the function by hand. If you call the function again with different types, then new instances of the function are instantiated to match those types, just as if you'd manually written the overloads yourself.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do you mean by Instantiating the function template?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How will you overload a template function?

The only reason to overload a template function is to provide an overload that differs in the number and type of arguments that cannot be addressed by the template function alone. You simply declare them as you would any other overload. The overloads may themselves be template functions, but there must be no ambiguity: every template function must generate an unique function signature. Remember that template functions generate overloads at compile time on an as-required basis.


What is the differnce between ordinary function and template function of c language?

The c language does not have template functions. That is a c++ thing.


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.


When to create a template function?

A template function is used when you want to write some kind of function that can be applied to different data types. It is a form of overloading, but you don't have to actually write all of the overloaded variants.


Distinguish between class template and template class?

Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It?s jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It?s jargon for plain classes. Class template is a template used to generate template classes. We cannot declare an object of a class template. Template class is an instance of a class template.

Related questions

How will you overload a template function?

The only reason to overload a template function is to provide an overload that differs in the number and type of arguments that cannot be addressed by the template function alone. You simply declare them as you would any other overload. The overloads may themselves be template functions, but there must be no ambiguity: every template function must generate an unique function signature. Remember that template functions generate overloads at compile time on an as-required basis.


What is the differnce between ordinary function and template function of c language?

The c language does not have template functions. That is a c++ thing.


Where can you get a sun template?

From the Sun god? What do you mean by "template"?


What does template wizard mean?

discuss the template wizard


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.


When to create a template function?

A template function is used when you want to write some kind of function that can be applied to different data types. It is a form of overloading, but you don't have to actually write all of the overloaded variants.


When and how a c compiler generate actual function from its template?

At the point it is used.


What do you mean by template in basic computer programmingwrite a general syntax for defining the template?

template is nothing but the design which have all the information


How does a DNA molecule act as a template?

Template DNA is a DNA you want to amplify. So you should know what you are amplifying before a PCR or you can make it by sequencing your PCR product.


What is an important function of the non-sense strand?

it serves as template for RNA synthesize


Distinguish between class template and template class?

Template class: A generic definition or a parametrized class not instantiated until the client provides the needed information. It?s jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It?s jargon for plain classes. Class template is a template used to generate template classes. We cannot declare an object of a class template. Template class is an instance of a class template.


What is difference between template and inline functions?

Template function would be global, they would have effect on all the pages within the template. Inline, would be regarding a specific line of code within a table or Div tag.