Convenient way to define all comparison operators for class with one numeric data member?

后端 未结 3 1259
眼角桃花
眼角桃花 2021-01-13 13:08

If I have a type that consists of a single numeric data member (say, an int) and various methods, is there a convenient way to tell the compiler to automaticall

3条回答
  •  梦谈多话
    2021-01-13 14:03

    Have you looked at boost operators (http://www.boost.org/doc/libs/1_56_0/libs/utility/operators.htm)? It defines a bunch of templates to help you automatically define operators in your class.

提交回复
热议问题