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