How does a vector know it goes out of scope?