Last active
March 14, 2016 17:11
-
-
Save longlongjump/cd6d800a1b7095efd4f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| template<typename T> | |
| void foo(T val) { | |
| std::cout << "void foo<T>(T val)" << std::endl; | |
| } | |
| void foo(int val) { | |
| std::cout << "void foo(int val)" << std::endl; | |
| } | |
| template<typename T> | |
| void test(T val) { | |
| foo(val); | |
| } | |
| int main() { | |
| test(42); //prints "void foo(int val)" | |
| test("42"); //prints "void foo<T>(T val)" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment