摘要: v.at(n)返回v指定位置n的元素。at函数比[]运算符更加安全, 因为它不会让你去访问到越界的元素,一旦越界将会在运行时中止程序并抛出一个异常std::out_of_range。例如 vector<int> v(10,0); cout<<v[11]<<endl; []运算符访问了vector末尾 阅读全文
posted @ 2022-08-11 14:13 jessicaland 阅读(243) 评论(0) 推荐(0)