#include <iostream>
#include <vector>
#include <list> std::list<std::string> getTotalEntrollment(std::vector<std::list<std::string>> courseStudent,
std::list<std::string> dropStudent)
{
std::list<std::string> allStudent;
for(auto &list : courseStudent)
{
allStudent.insert(std::end(allStudent),std::begin(list),std::end(list));
}
allStudent.sort();      //升序排列
allStudent.unique();     //去除重复的std::stirng name
for(auto &it : dropStudent)
{
allStudent.remove(it);  //去除在courseStudent中出现的dropStudent中的元素,注意这里不能用erase()方法
}
return allStudent;
}
int main()
{
std::list<std::string> list_1;
std::list<std::string> list_2;
std::list<std::string> list_3;
std::vector<std::list<std::string>> vecList;
std::list<std::string> resultList;
std::list<std::string> dropList; list_1.push_back("abc");
list_1.push_back("bcd");
list_1.push_back("cde"); list_2.push_back("dnd");
list_2.push_back("skd");
list_2.push_back("dnd"); list_3.push_back("");
list_3.push_back("");
list_3.push_back(""); dropList.push_back("abc");
dropList.push_back("dnd"); vecList.push_back(list_1);
vecList.push_back(list_2);
vecList.push_back(list_3); resultList = getTotalEntrollment(vecList,dropList); for(auto it : resultList)
{
std::cout << it << std::endl;
} return ;
}

结果是:

213
424
bcd
cde
skd

list详解的更多相关文章

  1. Linq之旅:Linq入门详解(Linq to Objects)

    示例代码下载:Linq之旅:Linq入门详解(Linq to Objects) 本博文详细介绍 .NET 3.5 中引入的重要功能:Language Integrated Query(LINQ,语言集 ...

  2. 架构设计:远程调用服务架构设计及zookeeper技术详解(下篇)

    一.下篇开头的废话 终于开写下篇了,这也是我写远程调用框架的第三篇文章,前两篇都被博客园作为[编辑推荐]的文章,很兴奋哦,嘿嘿~~~~,本人是个很臭美的人,一定得要截图为证: 今天是2014年的第一天 ...

  3. EntityFramework Core 1.1 Add、Attach、Update、Remove方法如何高效使用详解

    前言 我比较喜欢安静,大概和我喜欢研究和琢磨技术原因相关吧,刚好到了元旦节,这几天可以好好学习下EF Core,同时在项目当中用到EF Core,借此机会给予比较深入的理解,这里我们只讲解和EF 6. ...

  4. Java 字符串格式化详解

    Java 字符串格式化详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 文中如有纰漏,欢迎大家留言指出. 在 Java 的 String 类中,可以使用 format() 方法 ...

  5. Android Notification 详解(一)——基本操作

    Android Notification 详解(一)--基本操作 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:AndroidDemo/Notification 文中如有纰 ...

  6. Android Notification 详解——基本操作

    Android Notification 详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 前几天项目中有用到 Android 通知相关的内容,索性把 Android Notificatio ...

  7. Git初探--笔记整理和Git命令详解

    几个重要的概念 首先先明确几个概念: WorkPlace : 工作区 Index: 暂存区 Repository: 本地仓库/版本库 Remote: 远程仓库 当在Remote(如Github)上面c ...

  8. Drawable实战解析:Android XML shape 标签使用详解(apk瘦身,减少内存好帮手)

    Android XML shape 标签使用详解   一个android开发者肯定懂得使用 xml 定义一个 Drawable,比如定义一个 rect 或者 circle 作为一个 View 的背景. ...

  9. Node.js npm 详解

    一.npm简介 安装npm请阅读我之前的文章Hello Node中npm安装那一部分,不过只介绍了linux平台,如果是其它平台,有前辈写了更加详细的介绍. npm的全称:Node Package M ...

  10. .NET应用和AEAI CAS集成详解

    1 概述 数通畅联某综合SOA集成项目的统一身份认证工作,需要第三方系统配合进行单点登录的配置改造,在项目中有需要进行单点登录配置的.NET应用系统,本文专门记录.NET应用和AEAI CAS的集成过 ...

随机推荐

  1. 非法关闭idea后报错,插件无法正常加载解决方法

    Problems found loading plugins: Plugin "GlassFish Integration" was not loaded: required pl ...

  2. MySQL,Oracle,PostgreSQL,mongoDB 通过web方式管理维护, 提高开发及运维效率

    在开发及项目运维中,对数据库的操作大家目前都是使用客户端工具进行操作,例如MySQL的客户端工具navicat,Oracle的客户端工具 PL/SQL Developer, MSSQL的客户端工具查询 ...

  3. 简单Json序列化和反序列化

    序列化是什么: 序列化就是将一个对象的状态(各个属性量)保存起来,然后在适当的时候再获得.序列化分为两大部分:序列化和反序列化.序列化是这个过程的第一部分,将数据分解成字节流,以便存储在文件中或在网络 ...

  4. javascript判断浏览器支持CSS3属性

    function getsupportedprop(proparray){ var root=document.documentElement; //reference root element of ...

  5. jq中的isArray方法分析,如何判断对象是否是数组

    <!DOCTYPE html> <html> <head> <title>jq中的isArray方法分析</title> <meta ...

  6. toast, 警告窗

    //浮动提示框 1秒后消失 toast(msg, isError, sec) { var div = $('#toast'); div.html(msg); div.css({visibility: ...

  7. MongoDB 投影

    mongodb 投影意思是只选择必要的数据而不是选择一个文件的数据的整个.例如一个文档有5个字段,只需要显示其中3个 find() 方法 在MongoDB中,当执行find()方法,那么它会显示一个文 ...

  8. 【转载记录】Accessing Device Drivers from C#

    来源:http://www.drdobbs.com/cpp/accessing-device-drivers-from-c/184416423/   Device Drivers are writte ...

  9. 设置Web AppBuilder的HTTP代理

    在使用Web AppBuilder快速搭建webgis应用时,我们往往需要访问外部互联网的在线gis服务资源.假如要通过代理服务器才能访问互联网的在线gis服务资源,那么则需要预先配置web appb ...

  10. ORACLE数据仓库学习记录

    一.数据仓库安装 安装ORACLE DATABASE 10g Release 2 ORACLE数据库版本是:10.2.0.1.0(服务器).执行基本安装(安装全部的组件)并创建示例数据库. 安装ORA ...