vendredi 28 avril 2017

What's wrong with my Vector stopping all of a sudden?

I just made an account but I got frustrated and ended up making a profile. Anyways, I'm getting an error after it loops to element 4096. For some reason it stops there and just causes error. Have no idea. If you need more info, let me know. Any help will be appreciated

if(myFile.is_open()){

    while(getline(myFile, linePerLine) && cacheSizeVector.size() <= userInputCacheSize){

        cacheSizeVector.push_back(linePerLine);

        if (find(cacheSizeVector.begin(), cacheSizeVector.end(), linePerLine) != cacheSizeVector.end()){
            for(int i = 0; i <= userInputCacheSize; i++){
                if(cacheSizeVector[i] == linePerLine){    <<<<LINE OF ERROR!
                    lruCounter[i] = lruCounter[i] + 1;
                    cout << lruCounter[i] << endl;
                    cout << cacheSizeVector[i] << " HIT!" << endl;
                    cout << cacheSizeVector.size() << endl << endl;
                }
            }

        }
        else{
            std::cout << "Element not found in myvector\n";
        }

Some error that were initialized:

"{return __is_long() ? __get_long_size() : __get_short_size();}" << EXC_BAD_ACCESS

Aucun commentaire:

Enregistrer un commentaire