java - Saving a vector in another vector and clearing the first one -
i have technical issue in coding. below defining vector of vectors:
vector<vector<integer>> usupvec = new vector<vector<integer>>(); vector<integer> usup = new vector<integer>(); boolean isrep = false; (int = 1; <numsup ; i++) { usup.clear(); (int l = 0; l < i; l++) { if (supname[i] == supname[l]) { isrep = true; }} if (!isrep){usup.add(i);} (int j = i+1; j < numsup; j++) { if (supname[i] == supname[j]) { if (!isrep){usup.add(j);} }} isrep = false; usupvec.add((vector) usup); }
my problem whenever clearing usup vector, vectors stored in usupvec cleared. in each iteration want define vector of integer numbers , store in vector of vectors , clear vector store new values , store again in vector of vectors.
modify
usupvec.add((vector) usup);
to
usupvec.add(new vector(usup));
Comments
Post a Comment