Just a simple quick question which I couldn\'t find a solid answer to anywhere else. Is the default operator= just a shallow copy of all the class\' members on the right ha
As illustrated by the code snippet below, the = (assignment) operator for STL performs a deep copy.
#include #include #include #include using namespace std; int main(int argc, const char * argv[]) { /* performs deep copy */ map > m; stack s1; stack s2; s1.push(10); cout<<&s1<<" "<<&(s1.top())<<" "< > mp; stack s1p; stack s2p; s1p.push(new int); cout<<&s1p<<" "<<&(s1p.top())<<" "< v1,v2; vector v1p, v2p; v1.push_back(1); cout<<&v1<<" "<<&v1[0]<<" "<