I'm quite new to programming and it seems that one of the functions give me this error as soon as it runs over this line of code :
std::string name;
Right after I return *this, it goes through deallocating all of the std::vector that are inside the function, and also those associated with some of the named structures that I use. The 'name' variable itself is stored in another std::vector which is member of the class.
Does this mean that the string is written once and everything that should look like it will all point to the same reference ? Or maybe it is something else, but running the debugger line by line clearly fails on this line. Any help would be appreciated !
NOTE - I have deleted all of the previous code to show a simpler exemple of what I had as trouble :
#include <iostream>
#include <fstream>
using namespace std;
int main () {
string a = "something";
ofstream output; output.open("a.dat", ios::out|ios::binary);
output.write((char*)&a, sizeof(a)); output.close();
ifstream input; input.open("a.dat", ios::in);
string b;
input.seekg(0);
input.read((char*)&b, sizeof(b)); input.close();
return 0;
}
So if you run this block of code once, and right before running it a second time you remove the three first lines about the output, you have the error I was facing.