Last active
January 26, 2018 12:06
-
-
Save yoh2/42b375f41978c7486f958447fa3e5f19 to your computer and use it in GitHub Desktop.
a == 1 && a == 2 && a == 3 を真に。
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 <iostream> | |
struct A | |
{ | |
constexpr bool operator==(int) const | |
{ | |
return true; | |
} | |
}; | |
int main() | |
{ | |
A a; | |
std::cout << std::boolalpha << (a == 1 && a == 2 && a == 3) << std::endl; | |
} |
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
public class Hoge | |
{ | |
public static void Main(string[] args) | |
{ | |
var a = new Hoge(); | |
System.Console.WriteLine("{0}", a == 1 && a == 2 && a == 3); | |
} | |
public static bool operator==(Hoge hoge, int n) | |
{ | |
return true; | |
} | |
public static bool operator!=(Hoge hoge, int n) | |
{ | |
return false; | |
} | |
} |
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
import std.stdio; | |
struct A | |
{ | |
public bool opEquals(int n) const | |
{ | |
return true; | |
} | |
} | |
void main() | |
{ | |
A a; | |
writeln(a == 1 && a == 2 && a == 3); | |
} |
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
data A = A deriving Eq | |
instance Num A where | |
_ + _ = A | |
_ * _ = A | |
negate = id | |
abs = id | |
signum = id | |
fromInteger _ = A | |
main :: IO () | |
main = let a = A in print $ a == 1 && a == 2 && a == 3 |
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
struct A; | |
impl PartialEq<i32> for A { | |
fn eq(&self, _: &i32) -> bool { | |
true | |
} | |
} | |
fn main() { | |
let a = A; | |
println!("{}", a == 1 && a == 2 && a == 3); | |
} |
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
main :: IO () | |
main = let a = () in a == 1 && a == 2 && a == 3 | |
where _ == _ = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment