Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#include <iostream>
template<typename T>
void func(T)
std::cout << "generic\n";
void func<int>(int)
std::cout << "specialized for int\n";
void func(int)
std::cout << "regular function\n";
int main()
func(1.5); // generic
func<int>(2); // specialized for int
func(3); // regular function
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment