とから演算子>
、>=
、<=
、およびを取得するにはどうすればよいですか?!=
==
<
標準ヘッダー<utility>
は、上記の演算子を演算子==
andに関して定義する名前空間 std::rel_ops を定義します<
が、それを使用する方法がわかりません (次のような定義を使用するようにコードを誘導します:
std::sort(v.begin(), v.end(), std::greater<MyType>);
非メンバー演算子を定義した場所:
bool operator < (const MyType & lhs, const MyType & rhs);
bool operator == (const MyType & lhs, const MyType & rhs);
私#include <utility>
が指定した場合using namespace std::rel_ops;
、コンパイラはまだそれを訴えbinary '>' : no operator found which takes a left-hand operand of type 'MyType'
ます..