Assignment of data-member in read-only structure, class in STL set

前端 未结 3 509
遇见更好的自我
遇见更好的自我 2021-02-14 19:09

The minimal example of the problem I\'m having is reproduced below:

#include 
using namespace std;

class foo {
public:
  int value, x;
  foo(const in         


        
3条回答
  •  一整个雨季
    2021-02-14 19:48

    From the definition of the operator< (i.e. considering only the value return value < rhs.value and ignoring the x), I am wondering whether you want a map instead of a set. In map, the second value is mutable.

提交回复
热议问题