您的位置:首页 > 其它

vector的一些操作

2015-07-29 14:52 330 查看
做题的时候,碰到vector的一些函数,特此记下来。1.reserve(n): Requests that the vector capacity be at least enough to contain n elements2.lower_bound
1)lower_bound (ForwardIterator first, ForwardIterator last,
const T& val);
2)lower_bound (ForwardIterator first, ForwardIterator last,
const T& val, Compare comp);
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.3.upper_bound
1)upper_bound (ForwardIterator first, ForwardIterator last,
const T& val);
2)upper_bound (ForwardIterator first, ForwardIterator last,
const T& val, Compare comp);
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val.
4.insertvoid insert (iterator position, InputIterator first, InputIterator last);
从position开始,插入[first, last)的元素
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: