you are recreating the arr 11 time in your loop i think you meant to do this :
//the error is generated because you are trying to access an element out of bounds because your declaration is wrong
std::vector<MyClass> arr;
for(unsigned long long i = 0 ; i<=10;i++){
arr.emplace_back( 10,20+i);
std::cout << arr[i].ggg;
}
0
solved How create dynamic list with class in C++ [closed]