Hi everybody I am currently trying to write a recursive member function inside of a class which uses a private data member to call itself again. I have not been able to figure out why I can't call it recursively and go to this block in the vector.h file instead of recalling the function. I assume its to do with the range but while debugging I can clearly see that such a member exists.
reference
  at(size_type __n)
  {
_M_range_check(__n);
return (*this)[__n];
  }
My code is as follows:
void generateMaze(bool seedSet,cell currentCell){
        //this should work in theory need to debug.
        int x;
        int y;
        if(!seedSet){
            seed = rand() % 4;
        } 
        //currentCellNeedsToBePassedByReference
        //FigureOutWhatCurrentCell Should be
        currentCell.setVisited(true);
        currentCell.getPosition(x,y);
        //This whole if else chain is a way of picking a random valid direction.
        //The problem is we try to access nonexisting elements.
        if((x-1>=0 && y>=0 && x-1<=columns-1 && y<=rows-1) && seed%4==0){
            if(!cellVector.at(y).at(x-1).checkVisited()){
                currentCell.setWestWall(false);
                cellVector.at(y).at(x).setWestWall(false);
                cellVector.at(y).at(x-1).setEastWall(false);
                mazeVisual.at(y*2+1).at(x*4) = ' ';
                generateMaze(seedSet,cellVector.at(y).at(x-1));
            }
        } else
        if((x>=0 && y-1>=0 && x<=columns-1 && y-1<=rows-1) && seed%4==1){
            if(!cellVector.at(y-1).at(x).checkVisited()){
                currentCell.setNorthWall(false);
                cellVector.at(y).at(x).setNorthWall(false);
                cellVector.at(y-1).at(x).setSouthWall(false);
                mazeVisual.at(y*2).at(x*4+1) = ' ';
                mazeVisual.at(y*2).at(x*4+2) = ' ';
                mazeVisual.at(y*2).at(x*4+3) = ' ';
                generateMaze(seedSet,cellVector.at(y-1).at(x));
            }
        } else
        if((x+1<=columns-1 && y<=rows-1 && x+1 >= 0 && y >= 0) && seed%4==2){
            if(!cellVector.at(y).at(x+1).checkVisited()){
                currentCell.setEastWall(false);
                cellVector.at(y).at(x).setEastWall(false);
                cellVector.at(y).at(x+1).setWestWall(false);
                mazeVisual.at(y*2+1).at(x*4+4) = ' ';
                generateMaze(seedSet,cellVector.at(y).at(x+1));
            }
        } else
        if((x<=columns && y+1<=rows && x >= 0 && y+1 >= 0) && seed%4==3){
            if(!cellVector.at(y+1).at(x).checkVisited()){
                currentCell.setSouthWall(false);
                cellVector.at(y).at(x).setSouthWall(false);
                cellVector.at(y+1).at(x).setNorthWall(false);
                mazeVisual.at(y*2+2).at(x*4+1) = ' ';
                mazeVisual.at(y*2+2).at(x*4+2) = ' ';
                mazeVisual.at(y*2+2).at(x*4+3) = ' ';
                std::cout << cellVector.at(y+1).at(x).checkVisited();
                //this is the problem spot, the function cant be called for some reason.
                generateMaze(seedSet,cellVector.at(y+1).at(x));
            }
        }
        return;
    }
I know that it doesn't look great but Ihope you can help I just can't understand why it says vector is out of range when in the debug it shows that I have a cellVector filled with cell instances. I added lots of input checks and make sure that cellvector is not empty and has the structure of a 2d array with sizes [1][1]. I hope you can help. Thank you.
