A function template is a function which contains generic code to operate on different types of data. This enables a programmer to write functions without having to specify the exact type of parameters. Syntax for defining a template function is as follows: 1 2 3 4 5 template<class Type, ...> return–type function–name(Type arg1, ...) { //Body of function template } As shown above, the syntax starts with the keyword template followed by a list of template type arguments or also called generic arguments. The template keyword tells the compiler that what follows is a template. Here, class is
The post What are function templates in C++ Programming appeared first on Coding Security.
What are function templates in C++ Programming
read more
Tidak ada komentar:
Posting Komentar