Last active
April 13, 2017 05:25
-
-
Save qgp9/99471ba5d2c39569aa5e46fc5b976d2b 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> | |
using namespace std; | |
// A | |
template<typename T> void foo(T) {cout<<"A";} | |
// B | |
template<typename T> void foo(T*) {cout<<"B";} | |
// C | |
template<> void foo<int*>(int*) {cout<<"C";} | |
// D | |
template<> void foo<int>(int*) {cout<<"D";} | |
// E | |
void foo(int*) {cout<<"E";} | |
int main(){ | |
int * v; | |
foo(v); // A~E 중 어느 것이 호출될까? | |
cout<<endl; | |
return 0; | |
} |
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
template<typename T> // A. | |
void foo(T) {} | |
template<typename T> // B | |
void foo(T*) {} | |
template<> // C | |
void foo<int*>(int*) {} | |
int main(){ | |
int * v; | |
foo(v); // A~C 중 어느 것이 호출될까? | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment