vector.erase() function not working as expected.

Even though i have earsed the element from the vector.querying v[0] still returns the integer and "it" returns the value. The v.size() throws 0 though.its confusing me , can someone help.

int main(){
    
    vector<int> v;
    v.push_back(90);
    vector<int> :: iterator it;
    
    it = v.begin();
    v.erase(it);
    cout<<v.size()<<'\n';

    cout<<v[0]<<'\n';
    cout<<*it<<'\n';
}
Comments (0)