This will fail, as you will try to access element size(), and well a 1-sized array has element 0 as it's last element. Do a push_back instead?