I simply assign set1 to set2 like this
set2 = set1;
will this assignment will copy whatever in set1 to set2? (deep
even the vector items?),
Yes, it will copy everything, provided that set items have proper
copy constructor. The `std::vector' container can copy itself
without a problem.
well my coworker told me that I need to have a define my own
constructor for ItemSet, ItemListA and ItemListB for it works
properly. in the copy contructor of ItemSet,
a = toCopy.a;
b = toCopy.b;
notice a and b are classes that I defined, to enable a =
works properly. I need to define copy contructor in my ItemListA
ItelListB classes, basically, to manually the vector from the
is his statement true?
No. Either he misunderstood your design or plain wrong about copy
Both `ItemA' and `ItemB' classes don't need explicit copy
constructor since compiler generated cctor is good enough. The
`std::string' container knows how to copy itself and other types
are just fine with language provided copy.
The `ItemSet' class doesn't need cctor either since all its
members know how to copy themselves.
std::vector <ItemA> m_vecA;
std::vector <ItemB> m_vecB;
Both `ItemListA' and `ItemListB' classes don't need explicit copy
constructor since their only memebr is `std::vector', which has