'Drawing updating vector of CircleShapes FillColor not updating

I am learning some C++ by making a small GUI based thing, and I am trying to make a hex grid currently. I want to be able to click on a hexagon, and have it change colour currently, as a way of testing a variety of things.

The issue I am facing is that the draw method does not update the vector of shapes evens though the vector of shapes does contain new data. I am lost on how to fix this, so any help is greatly appreciated.

Layer.cpp draw function

void Layer::draw(sf::RenderTarget& target, sf::RenderStates states) const {


//hexagons
    
    for (int i = 0; i < this->cells.size(); i++) {
        target.draw(this->cells[i], states);
    }


}

Layer.cpp setCellColor

void Layer::setCellColor(sf::Vector2f worldPos){
    this->cells[0].setFillColor(sf::Color::Red);
}

setCellColor is called by main. I have made another function that prints out the colour of cell 0, and it updates properly, there is something wrong with how I am drawing the cells



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source