for (int i = 0; i < 10; i++)
{
nueron temp; // my Class
_inputNuerons.push_back(temp); // _inputNuerons is a std::vector
}
From what I know , C++ deallocates the temp object when it reaches the } bracket of the for loop. But does storing the object in a std::vector make the object usable later on in the program ? Now when I try to access the "temp" nueron outside the for loop , the program crashes.
How can I store my objects in a std::vector such that it is usable later on ?
Aucun commentaire:
Enregistrer un commentaire