Created
November 14, 2015 09:43
-
-
Save yuba/90268eb9b060e9f5c370 to your computer and use it in GitHub Desktop.
operator==()が定義してあればoperator!=()を書かなくてもよくするやつ ref: http://qiita.com/yuba/items/d352c4ba9b2d4bc10bbe
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
template<class T, class F = decltype(!(std::declval<T>()==std::declval<T>()))> | |
// 自動的に定義される!=演算子。==演算子の結果に!演算子を適用した結果を返します。 | |
F operator!=(T a, T b) | |
{ | |
return !(a==b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment