Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Python Like C++ Overload Function Template
//g++ 7.4.0 /**************************** Python like print() multiple data type overload function template by: Robin Deatherage *****************************/ #include <iostream> #include <string.h> template <typename Transylvania> void print (Transylvania ghost) { std::cout << ghost; }; using namespace std; int main() { print("["); print("string");// char string print(", "); print(7.274); // float print(", "); print(198+2); // integer print(", "); print("67"); // char string number print("]"); }
run
|
edit
|
history
|
help
0
Handling new types without using RTTI
Filtering a vector attribute with template UnaryPredicate
DFS
Dead_Lock
1234
rstring
Simulare 2022
Double_wrapper gcc
Avoiding visited networked paths
char array in class