So I have a defined copy constructor which deep copies elements of an array, however when I run the program, it crashes and I get the error:
"Invalid allocation size: 4294967295 bytes"
size() method returns a private int variable 'm_size' - which is set to 4000. And I've checked the constructor and m_size is defined before 'data'. So it's not crashing because of that. But from my understanding of the error m_size is not read properly and it crashes!! :/
1 2 3 4 5 6 7 8 9 10 11
CArray::CArray(const CArray &A)
m_size = size();
data = new string[m_size];
for(int i = 0; i < m_size; i++) // loops through copying elements.
data[i] = A.data[i];
Any ideas why I'm getting the error and why it's not reading m_size properly?!