Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
How to make stupid to my friend?
Find Case Combinations of a String
Matrix
matrix2
Pairs having sum equal to target
memcpy
C++ Car Racing game framework 2
Policy based smart pointer
Dar
Pollard Rho Brent Integer Factorization - 11476 - Factorizing Larget Integers
Please log in to post a comment.