次のようないくつかの数値フィールドを持つクラスがあります。
class Class1 {
    int a;
    int b;
    int c;
public:
    // constructor and so on...
    bool operator<(const Class1& other) const;
};
このクラスのオブジェクトを のキーとして使用する必要がありますstd::map。したがって、私は実装しoperator<ます。operator<ここで使用する最も簡単な実装は何ですか?
編集:
の意味は<、フィールドのいずれかが等しくない限り、一意性を保証するために想定できます。
編集2:
単純な実装:
bool Class1::operator<(const Class1& other) const {
    if(a < other.a) return true;
    if(a > other.a) return false;
    if(b < other.b) return true;
    if(b > other.b) return false;
    if(c < other.c) return true;
    if(c > other.c) return false;
    return false;
}
この投稿の背後にある全体的な理由は、上記の実装が冗長すぎると感じたからです。もっと単純なものがあるはずです。