Last active
August 9, 2017 10:07
-
-
Save iffyuva/130c527ecb21349f765c1c1a644832c2 to your computer and use it in GitHub Desktop.
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> | |
class square {}; | |
class circle {}; | |
template <typename T> | |
void f(T) { std::cout << "default template" << std::endl; } | |
void f(square) { std::cout << "square" << std::endl; } | |
void f(circle) { std::cout << "circle" << std::endl; } | |
int main () { | |
f(square()); | |
f(circle()); | |
f(10); | |
return 0; | |
} | |
// Output: | |
// square | |
// circle | |
// default template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment