Created
March 25, 2019 09:58
-
-
Save Mulperi/d2746f429b5de84b4a9f02884e9aae06 to your computer and use it in GitHub Desktop.
c++ template function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
template <class T> | |
T getMax(T a, T b) | |
{ | |
return a > b ? a : b; | |
} | |
int main() | |
{ | |
std::cout << getMax(1, 2) << std::endl; | |
std::cout << getMax(2.1, 2.0) << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment