|
|
|
|
|
by pkolaczk
2239 days ago
|
|
Because it leads to hard to understand code. If N unrelated (or loosely related) things can mutate the same object, then you get a O(x^N) explosion of potential mutation orders and in order to understand that, you need to understand all the (sometimes complex) time-relationships between these N objects. This gets even much worse when some of these objects are also pointed from M other objects... On the flip side, in case of using a simple unique_ptr (or a similar concept), this trivially reduces to a single sequence of modifications. |
|