1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> using namespace std; template <typename T> void f(T & t) { cout << __PRETTY_FUNCTION__ << endl; } void f(const string &) { cout << __PRETTY_FUNCTION__ << endl; } void f(int) { cout << __PRETTY_FUNCTION__ << endl; } int main() { f(1.0); f(1); f(string("sss")); string a; f(a); } |
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4KICAgIHZvaWQgZihUICYgdCkKICAgIHsKICAgICAgIGNvdXQgPDwgX19QUkVUVFlfRlVOQ1RJT05fXyA8PCBlbmRsOwogICAgfQogICAgdm9pZCBmKGNvbnN0IHN0cmluZyAmKQogICAgewogICAgICAgY291dCA8PCBfX1BSRVRUWV9GVU5DVElPTl9fIDw8IGVuZGw7CiAgICB9CiAgICB2b2lkIGYoaW50KQogICAgewogICAgICAgY291dCA8PCBfX1BSRVRUWV9GVU5DVElPTl9fIDw8IGVuZGw7CiAgICB9CiAgICBpbnQgbWFpbigpCiAgICB7CiAgICAgICAgZigxLjApOwogICAgICAgIGYoMSk7CiAgICAgICAgZihzdHJpbmcoInNzcyIpKTsKCXN0cmluZyBhOwoJZihhKTsKICAgIH0K
-
upload with new input
-
result: Success time: 0.02s memory: 2856 kB returned value: 0
void f(int) void f(int) void f(const std::string&) void f(T&) [with T = std::string]
http://stackoverflow.com/questions/13182234/can-compiler-tell-me-which-overloaded-or-template-function-it-chose/13188938#13188938


