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 ?
Your neuron object will be destroyed at the end of for block. You should use dynamic allocation, and store the pointer on that object in vector.
_inputNeurons collection should be collection of neuron pointers.