class BPP
{
unsigned n; /* nº de instancias */
vector<string> nombre_instancia; /* nombre de la instancia*/
In the constructor, I get a segmentation fault (core dumped) when:
file1.open(fich1);
if (file1.is_open()){
file1 >> (unsigned &) n;
for (unsigned k = 0 ; k < n ; ++k){
getline(file1, nombre_instancia[k]); #gives the segmentation fault
The 2 first lines in fich1 are:
10
P_0
I guess that you have not resized nombre_instancia beyond its original size of 0. Try this instead: