Last active
December 12, 2015 00:58
-
-
Save ashgti/4687317 to your computer and use it in GitHub Desktop.
Don't do this ever please. If you have to, please comment it.
This file contains 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 <stdio.h> | |
struct foo { | |
struct dummy { | |
int i; | |
}; | |
typedef int dummy::*_bool; | |
foo(int f) : f_(f) {} | |
int f_; | |
operator _bool() const { | |
return f_ ? &dummy::i: 0; | |
} | |
}; | |
int main() { | |
foo bar(3); | |
if (bar) { | |
puts("yes"); | |
} else { | |
puts("no"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment