STL_ALGORITHM_H
sort_unique_copy
///////////////////////////////////////////////////////////
// Copyright (c) 2013, ShangHai Onewave Inc.
//
// FileName: sort_unique_copy.cpp
//
// Description:
//
// Created: Thu Mar 27 09:44:51 2014
// Revision: Revision: 1.0
// Compiler: g++
//
/////////////////////////////////////////////////////////// #include <iostream>
#include <list>
#include <string>
#include <algorithm> using namespace std; int main(void)
{
list<string> m_list;
m_list.push_back("c");
m_list.push_back("cc");
m_list.push_back("b");
m_list.push_back("bb");
m_list.push_back("bb");
m_list.push_back("aa");
m_list.push_back("a"); cout<<"\t--------"<<endl;
for(list<string>::iterator it=m_list.begin(); it!=m_list.end(); it++)
{
cout<<'\t'<<*it<<endl;
} m_list.sort();
cout<<"\t--------"<<endl;
for(list<string>::iterator it=m_list.begin(); it!=m_list.end(); it++)
{
cout<<'\t'<<*it<<endl;
} list<string> m_copyList;
unique_copy(m_list.begin(),m_list.end(),back_inserter(m_copyList));
cout<<"\t--------"<<endl;
for(list<string>::iterator it=m_copyList.begin(); it!=m_copyList.end(); it++)
{
cout<<'\t'<<*it<<endl;
}
return ;
}
g++ -Wall -o sort_unique_copy sort_unique_copy.cpp
./sort_unique_copy
--------
c
cc
b
bb
bb
aa
a
--------
a
aa
b
bb
bb
c
cc
--------
a
aa
b
bb
c
cc
STL_ALGORITHM_H的更多相关文章
随机推荐
- ORACLE增加用户
create user 账号 identified by "密码"; grant connect to 账号; grant resource to 账号; --把dba 权限给in ...
- 【转】IMSI和IMEI
国际移动客户识别码(International Mobile Subscriber Identification Number) 为了在无线路径和整个GSM移动通信网上正确地识别某个移动客户,就必须给 ...
- 机器学习:PCA(使用梯度上升法求解数据主成分 Ⅰ )
一.目标函数的梯度求解公式 PCA 降维的具体实现,转变为: 方案:梯度上升法优化效用函数,找到其最大值时对应的主成分 w : 效用函数中,向量 w 是变量: 在最终要求取降维后的数据集时,w 是参数 ...
- 虚幻引擎4设置Visual Studio
转自:http://www.unrealchina.net/portal.php?mod=view&aid=149 设置Visual Studio和虚幻引擎4协同工作有利于提高开发人员使用UE ...
- 升级 AngularJS 至 Angular
Victor Savkin 大神撰写了一系列文章详细介绍如何升级 AngularJS 应用: NgUpgrade in Depth Upgrade Shell Two Approaches to Up ...
- 2016.1.22 利用LINQ实现DataSet内多张DataTable关联查询操作(目前未发现太大价值)
DataSet ds = new DataSet(); DataTable t1 = DBFactorySingleton.GetInstance().Factory.GetDataTable(sql ...
- eclipse中server location为灰色,不能修改
Eclipse中tomcat service设置发布时间︰选择window ----show view---services可以看到服务的面板双击tomcat进入配置界面Service Locatio ...
- easyui中 combogrid控件的loadData方法加载本地数据
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Hbase优化记录
<configuration><property><name>hbase.rootdir</name><value>hdfs://gagcl ...
- springmvc 注解式开发 接收请求参数
1.校正请求参数名: 2.以对象形式整体接收 3.路径变量: