Deep copy vector <Point> myArr
To make a deep copy of myArr ,
vector <Point> myArr; where Point is a class with 2 ints as members,
Do I need to do something? or ok with
vector <Point> otherArr = myArr; I need to delete multiple points in otherArr , but at the same time I need all the points in myArr for later use.
early
See Shallow and Deep Copy and Effective C ++
Point does not need a deep copy. As a rule of thumb, a deep copy is required when the class has pointer elements. The Point class has only two int members, so it does not require much effort for a "deep copy", a normal or "shallow copy" will work fine. In fact, it is not required to write a copy constructor for Point , by default or synthesized, provided by the compiler, it will be very good.
As for your second question, after the line
vector< Point > otherArr = myArr; PerformedotherArr and myArr are two independent independents . Operations (for example, deleting some elements) performed on one of them do not affect the others in any way.