I am currently getting an "0xC0000005: Access violation reading location 0xcccccce0." error and I have tried diagnose the problem...I think the problem comes in when my rule of 3 that I have defined comes in play and points me to here.
size_type size() const
{ // return length of sequence
return (this->_Mysize); <---------------------this line
}
I'm actually not sure if there is any problem at all, I have been dwelling on this for days on end.
Below is my rule of three
ArrayStorage::ArrayStorage(){
myArray = new string[7079];
}
ArrayStorage::~ArrayStorage(){
delete[] _data;
delete[] myArray;
}
ArrayStorage::ArrayStorage(const ArrayStorage &A) {
_size = A.size();
_data = new string [size()];
for (int i = 0; i < size(); ++i)
_data[i] = A[i];
}
ArrayStorage& ArrayStorage::operator=(const ArrayStorage &A){
if (this != &A) {
delete [] _data;
_size = A.size();
_data = new string [A.size()];
for (int i = 0; i < size(); ++i) {
_data[i] = A[i];
}
}
return *this;
}
const string& ArrayStorage::operator[](int i) const{
assert((i >= 0) && (i < size()));
return _data[i];
}
string& ArrayStorage::operator[](int i){
assert((i >= 0) && (i < size()));
return _data[i];
}
Anytime your access is denied, you will usually receive an access violation error, which usually reads, “Exception_Access_Violation.” In most cases, it comes with an error code or address. Malware infections and faulty hardware may cause the Exception_Access_Violation issue.
An access violation is a non-specific error that occurs while installing, loading, or playing a game. This error can be caused by the following: an interfering software program (usually an antivirus application), an outdated video card driver, or an outdated version of DirectX.
As its name says, this error occurs whenever you try to access a location that you are not allowed to access in the first place. In other words, whenever you will try to violate the norms of accessing a writing location set up by the C++ programming language, you will always come across this error.
It is stated that 0xC0000005 error usually occurs when a particular application is trying to access memory, which is no longer available or can't be accessed for some reason.
When uninitialized, stack variables are filled with 0xCC bytes if compiled with msvc. So 0xcccccce0 is probably the result of "this" being an uninitialized pointer variable on the stack plus _MySize offset in the object structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With