c++ 容器切片反转次序(不拷贝到新容器)
2024-09-05 05:22:43
// rotate algorithm example
#include <iostream> // cout
#include <algorithm> // rotate
#include <vector> // vector
using namespace std;
int main () {
vector<int> myvector; // set some values:
for (int i=; i<; ++i) myvector.push_back(i); // 1 2 3 4 5 6 7 8 9 rotate(myvector.begin(),myvector.begin()+,myvector.end());
// 4 5 6 7 8 9 1 2 3
// print out content:
cout << "myvector contains:";
for (vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it)
cout << ' ' << *it;
cout << '\n'; return ;
}
输出
myvector contains:
最新文章
- 有关对字符串的处理,需要用到List时的简化写法
- Pinyin4Net
- jsp或Action获取请求参数中文乱码
- POJ 3107	Godfather (树形dp)
- 【SVN Working copy is too old (format 10, created by Subversion 1.6)】解决方式
- 关于php输入$_post[‘’]报错的原因
- C嵌入汇编
- jquery表格datagrid单元格显示图片及分页使用
- everything of people’s life can changed in their twenties
- 《java入门第一季》之类StringBuffer类初步
- Percona-Toolkit 之 pt-online-schema-change 总结
- 通用网关接口 ruby perl web页面 文本处理 脚本语言
- python 拷贝文件
- Android混合式开发(Hybrid)
- 【Cf #291 B】R2D2 and Droid Army(二分,线段树)
- C++中前置声明的应用与陷阱
- ARP协议相关介绍
- s3cmd : Add a config parameter to enable path-style bucket access 当ceph rgw使用域名时,需要支持 path-style bucket特性
- 16位模式/32位模式下PUSH指令探究——《x86汇编语言:从实模式到保护模式》读书笔记16
- SQL Server ->;>; 高可用与灾难恢复(HADR)技术 -- AlwaysOn(实战篇)之建立活动目录域、DNS服务器和Windows故障转移群集(准备工作)
热门文章
- (六)CXF之自定义拦截器
- Spring基础篇——DI/IOC和AOP原理初识
- freemarker循环、下标及判断
- Spring Boot实现自定义注解
- log4j日志properties配置
- LAMP源码编译安装
- Nginx 的关键组件的介绍
- VMware Workstation 14 安装使用 (小白安装使用教程)
- doesn&#39;t declare an explicit app_label and isn&#39;t in an application in INSTALLED_APPS.
- CentOS6.9 Python环境配置(python2.7、pip、virtualenv)