Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pointer to template function
#include <iostream> #include <cstdlib> #include <string> using namespace std; template <typename TYPE> TYPE Tszamolas (TYPE (*fn_ptr)(TYPE, TYPE), TYPE be1, TYPE be2) { return fn_ptr(be1, be2); } template <typename TYPE> TYPE Tplusz(TYPE a, TYPE b) { return a + b; } int main() { string str1 = "rántott"; string str2 = "hús"; cout << Tszamolas(Tplusz, 1, 3) << endl; cout << Tszamolas(Tplusz, 1.4, 3.8) << endl; cout << Tszamolas(Tplusz, str1, str2) << endl; return 0; }
run
|
edit
|
history
|
help
0
Exploring the Transform Function and Operator Classes
Arithemetic operators
container store pointer
StackQuiz
Rubix
12hours Clock c++
fgm
remove_copy_if-30-Seconds-of-C++
BFS Basic
HCF