# C++ Function Template

## Introduction

C++ function template uses rvalue reference for different function expression arguments in the higher-order function. Because it is compiled time polymorphism, the code could be optimized very well and the performance should be very good.

In this blog post, I would like to show how to use the C++ function template.

## Examples

To compile the program, please run the following command in the terminal.

Using TF f would actually also work, but it would not serve as a reference. It copies the rvalues to f, which is unnecessary.

## Conclusions

The application of the function template might not be as generic as std::function, but its performance should be better.

Lei Mao

02-12-2020

02-12-2020