std::advance 给迭代器增加指定偏移量
来源:互联网 发布:linux rpm怎么安装 编辑:程序博客网 时间:2024/05/22 05:05
template < class InputIterator, class Distance >
void advance (InputIterator& it, Distance n);
迭代器辅助函数。
使迭代器it偏移n,其中n为整数。
#include <iostream> // std::cout#include <iterator> // std::advance#include <list> // std::listint main () { std::list<int> mylist; for (int i=0; i<10; i++) mylist.push_back (i*10); std::list<int>::iterator it = mylist.begin(); std::advance (it,5); std::cout << "The sixth element in mylist is: " << *it << '\n'; std::advance (it,-1); std::cout << "The fifth element in mylist is: " << *it << '\n'; return 0;}
The sixth element in mylist is: 50
The fifth element in mylist is: 40
0 1
- std::advance 给迭代器增加指定偏移量
- C++ std::advance给迭代器增加指定偏移量
- std::map 迭代器偏移出错
- c++ std:: advance
- oracle中对日期时间变量增加偏移量
- 偏移量
- 偏移量
- std::advance std::distance std::next
- 给std::string增加format函数
- 给std::string增加format函数
- python中为list中含list元素指定偏移key量及次偏移量的排序算法
- redis给指定内容增加次数等
- jquery 给html指定标签增加元素
- 结构体偏移量
- 偏移量详解
- javascript 偏移量
- 函数求偏移量
- 结构体偏移量
- Android基础知识_Activity组件
- poj 3190 优先队列+贪心
- 动态内存与智能指针
- Cannot convert value '0000-00-00 00:00:00' from column 1 to TIMESTAMP分析及解决办法
- 闰秒对linux的影响分析及解决
- std::advance 给迭代器增加指定偏移量
- docker_restful_api简介
- JsonUtil
- Eclipse 警告提示:Access restriction:The type JPEGCodec is not accessible due to restriction on
- POJ2236---Wireless Network
- 基于LGPL开源项目 Log4cpp安装与使用
- 一、认识jQuery
- 关于java.util.Scanner
- 高性能Mysql主从架构的复制原理及配置详解