Been using boost's disjoint_set
. It has a copy constructor. To my understanding, it uses pointers that are handed over during the constructor call to access it's data and it doesn't manage memory allocation on its own. Therefore, when you make a copy, the actual data (unlike when you copy a std::vector<T>
), isn't copied. You get two seemingly separate instances (cause you aren't using a reference) that access and modify the same data. This seems haphazard and the use case is not clear.
So the question is, why would you say that disjoint_set
's copy constructor is useful and why would you make a copy constructor that returns a shallow copy of an instance?