Created
June 18, 2015 00:33
-
-
Save thiagomg/f640a1d878547b31655f to your computer and use it in GitHub Desktop.
Templates e geração de código
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
int sumNonTemplated(int a, int b) { | |
return a+b; | |
} | |
template <typename T> | |
T sumTemplated(T a, T b) { | |
return a+b; | |
} | |
void run() { | |
sumTemplated(1, 2); | |
sumTemplated(1.0, 2.0); | |
sumTemplated(1.0f, 2.0f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment