What is the difference between function template and template function?

后端 未结 4 767
难免孤独
难免孤独 2021-02-05 11:01

What is the difference between function template and template function?

4条回答
  •  广开言路
    2021-02-05 11:35

    The function generated by the compiler from function template(generic function) for specified data type is known as template function. Example: The below code is called function template as it is template for a function.

    template
    T doubleVal(T a){
      return a+a;
     }
    int main(){
      cout<(5)<

    When we compile this code compiler will write a function for int by taking reference from template function. That function is known as template function.

提交回复
热议问题