Last active
August 29, 2015 14:23
-
-
Save cblp/41f958cded6207716364 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; | |
| template <typename A> | |
| A antiId(A x) { return x; } | |
| template <> | |
| int antiId<int>(int) { return 42; } | |
| int main() { | |
| cout << 1 << '\t' << antiId(1) << endl; | |
| // 1 42 | |
| cout << "test" << '\t' << antiId("test") << endl; | |
| // "test" "test" | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment