yohhoyの日記

技術的メモをしていきたい日記

Logical XOR operator Revival

C++ Evolution Working Group(EWG)に「論理XOR演算子^^」なるものが提案(?)されているが…
2023-07-23追記:同提案は2013年会合にて却下(NAD)*1されている。

C++ Standard Evolution Active Issues List, #37. Logical xor operatorより一部引用。

(snip) This has traditionally been dismissed as un-necessary, as it is equivalent to boolean operator!=, and there is no short-circuiting benefit to justify adding it. However, contextual conversions to 'bool' are handled specially for logical operators, and in that context it would be completing a hole in the language. (snip)

function<void()> a;
function<void()> b;
assert(a != b);  // does not compile
assert(a ^^ b);  // would compile, and assert!

どうでもよすぎるメモ:「(a ^^ b);」が煽り系顔文字に見えて仕方ない。

2015-03-05追記:C言語での同話題に対するDennis Ritchie氏の回答 http://c-faq.com/misc/xor.dmr.html

*1:Not A Defect