Comparison tricks in C++

前端 未结 10 1991
礼貌的吻别
礼貌的吻别 2021-01-31 16:13

A class:

class foo{
public:
    int data;
};

Now I want to add a method to this class, to do some comparison, to see if its data is equal to on

10条回答
  •  不要未来只要你来
    2021-01-31 16:51

    If data, num1, .. num6 are between 0 and 31, then you can use

    int match = ((1<

    If num1 to num6 are constants, the compiler will compute match at compile time.

提交回复
热议问题