Created
September 24, 2013 19:30
-
-
Save o11c/6690046 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 <cstdio> | |
| template<class T> | |
| class Pointer | |
| { | |
| T *v; | |
| public: | |
| Pointer(T *t) : v(t) {} | |
| __attribute__((used)) | |
| T *operator ->() | |
| { | |
| return v; | |
| } | |
| __attribute__((used)) | |
| T& operator *() | |
| { | |
| return *v; | |
| } | |
| }; | |
| __attribute__((noinline)) | |
| void test(Pointer<char *> p) | |
| { | |
| puts(*p); | |
| } | |
| int main(int argc, char **argv) | |
| { | |
| test(argv); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment