A
Alfonzo Morra
Hi,
If I have code like this :
class MyClass {
std::vector< int> arr_ ;
std::vector < std:air < long, double> > adj ;
......
MyClass( const MyClass& rhs) {
......
this->arr_ = rhs.arr_ ; //will the elements get copied accross
//into this->arr ?
this->adj = rhs.adj ; //more complicated vector, do elements
//(pairs) get copiedinto this->adj ?
.....
}
MyClass& operator=( const MyClass& rhs) {
if( this != rhs ) { // <- compiler barfs here
// how can I check to make sure !(same object)?
.......
}
}
If I have code like this :
class MyClass {
std::vector< int> arr_ ;
std::vector < std:air < long, double> > adj ;
......
MyClass( const MyClass& rhs) {
......
this->arr_ = rhs.arr_ ; //will the elements get copied accross
//into this->arr ?
this->adj = rhs.adj ; //more complicated vector, do elements
//(pairs) get copiedinto this->adj ?
.....
}
MyClass& operator=( const MyClass& rhs) {
if( this != rhs ) { // <- compiler barfs here
// how can I check to make sure !(same object)?
.......
}
}