What is this iterator for? You only increase it in your loop, but you don't use it anywhere.Qt Code:
vector < vector <double> > temp; temp.resize(_set->size()); vector < vector <double> >::iterator iit=temp.begin();To copy to clipboard, switch view to plain text mode
These conditions are redundant, I guess. By using % operator variable "i" takes value from interval 0 (incl), set->size()(excl). So if size is 1 then it's no use checking if "i" is zero. Additionally variable "i" will never be greater or equal then set->size().Qt Code:
int i=0; vector < vector <double> >::iterator itra = _set->begin(); srand ((unsigned)time(NULL)); while ( ! _set->empty() ) { do { i = rand() % (int) _set->size(); cout << " i " << i << endl; if (i == 0 && _set->size() == 1) break; } while (i >= (int) _set->size() || i == 0);To copy to clipboard, switch view to plain text mode
These two iterators points the same element. insert() method insert sequence from first(incl) to last(excl), so in your case it inserts nothing. Try to pass the last argument as itra+i+1.Qt Code:
temp.insert (temp.begin(), itra+i, itra+i); //here it is filling nothingTo copy to clipboard, switch view to plain text mode
Bookmarks