I am trying to create a move assignment function but I keep get getting "pointer being freed was not allocated"
const MyString& MyString::operator=(MyString&& move){
cout<< "Move Assignment" << endl;
if(this != &move){
delete[] str;
len = move.len;
for(int i = 0; i<len;i++){
str[i] = move.str[i];
}
move.str=nullptr;
move.len = 0;
return *this;
}
return *this;
}
a.out(37068,0x1000b45c0) malloc: * error for object 0x1001025a0: pointer being freed was not allocated a.out(37068,0x1000b45c0) malloc: * set a breakpoint in malloc_error_break to debug