Skip to content

Instantly share code, notes, and snippets.

@yuba
Created November 14, 2015 09:43
Show Gist options
  • Save yuba/90268eb9b060e9f5c370 to your computer and use it in GitHub Desktop.
Save yuba/90268eb9b060e9f5c370 to your computer and use it in GitHub Desktop.
operator==()が定義してあればoperator!=()を書かなくてもよくするやつ ref: http://qiita.com/yuba/items/d352c4ba9b2d4bc10bbe
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