Please excuse me if my understanding isn't up to par yet, Im still learning C++, and Im coming from an interpreted language (R).
My question is regarding the usage of vectors as index containers for range based for
loops, In the following example :
//Declare
std::vector<int> a{5,1,6,9} ;
std::vector<int> b{0,3} ;
//Reserve Memory
a.reserve(100) ;
//Loop & Modify
for(int i : b){
a.push_back(a[i] + 400) ;
}
My question is, can this result in undefined behavior in some way?