Skip to content

Instantly share code, notes, and snippets.

@iffyuva
Last active August 9, 2017 10:07
Show Gist options
  • Save iffyuva/130c527ecb21349f765c1c1a644832c2 to your computer and use it in GitHub Desktop.
Save iffyuva/130c527ecb21349f765c1c1a644832c2 to your computer and use it in GitHub Desktop.
#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