class MapTest:public CapTest
{

private:
set <string> MyTestContain;
typedef pair <string,int> myPairDef;
typedef map <string,int> myMapDef;
myMapDef MyMap1;

public:
MapTest();
~MapTest(){};
void OutPut();
friend void MyOutPut2(myPairDef thispair);

};

void MyOutPut2(MapTest::myPairDef thispair)
{
cout<<thispair.first;
}

void MapTest::OutPut()
{

std::for_each(MyMap1.begin(), MyMap1.end(), MyOutPut2);
cout << endl;

}

for_each 用法!的更多相关文章

  1. 匿名函数和for_each用法

    匿名函数,C++11的 for_each 用法 #include <iostream> #include <algorithm> #include "testClas ...

  2. for_each用法

    for_each()是个function template #include <algorithm>头文件说明 template<class _InIt, class _Fn1> ...

  3. CPP STL学习笔记

    STL的概念 源地址  https://www.ev0l.art/index.php/archives/15/ <li> Iterator (迭代器)<li> Containe ...

  4. 《STL源码剖析》学习半生记:第一章小结与反思

    不学STL,无以立.--陈轶阳 从1.1节到1.8节大部分都是从各方面介绍STL, 包括历史之类的(大致上是这样,因为实在看不下去我就直接略到了1.9节(其实还有一点1.8.3的内容)). 第一章里比 ...

  5. c++11的for新用法 (重新练习一下for_each)

    看到手册的代码里面有个for的很奇怪的用法,用了一把    http://www.cplusplus.com/reference/unordered_set/unordered_set/insert/ ...

  6. C++11之for循环的新用法

    C++使用如下方法遍历一个容器: #include "stdafx.h" #include<iostream> #include<vector> int m ...

  7. STL vector用法介绍

    STL vector用法介绍 介绍 这篇文章的目的是为了介绍std::vector,如何恰当地使用它们的成员函数等操作.本文中还讨论了条件函数和函数指针在迭代算法中使用,如在remove_if()和f ...

  8. c++ bind1st 和 bind2nd的用法

    std::bind1st 和 std::bind2nd将二元函数转换为一元函数,具体用法参加下面的代码. 代码介绍了两种使用方式,第一种是使用std::less和std::greater,第二种是使用 ...

  9. c++ algorithm 的用法

    1 , accumulate()template<class _II, class _Ty> inline_Ty accumulate(_II _F, _II _L, _Ty _V){fo ...

随机推荐

  1. Spark 启动过程(standalone)

    Spark启动过程 正常启动Spark集群时往往使用start-all.sh ,此脚本中通过调用start-master.sh和start-slaves.sh启动mater及workers节点. 1. ...

  2. PHP Java

    http://my.oschina.net/lajp/blog/5121 http://blog.163.com/lijianwei_123/blog/static/18489289120115244 ...

  3. ural 1104 Don’t Ask Woman about Her Age

    http://acm.timus.ru/problem.aspx?space=1&num=1104 #include <cstdio> #include <cstring&g ...

  4. BZOJ3433: [Usaco2014 Jan]Recording the Moolympics

    3433: [Usaco2014 Jan]Recording the Moolympics Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 55  So ...

  5. BZOJ3398: [Usaco2009 Feb]Bullcow 牡牛和牝牛

    3398: [Usaco2009 Feb]Bullcow 牡牛和牝牛 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 30  Solved: 17[Sub ...

  6. DP #1 Singleton Pattern线程安全问题

    单例模式确保一个类只有一个实例,自行提供这个实例并向整个系统提供这个实例. 其中涉及到最主要的问题就是在多线程并发时线程安全问题. 单例模式的实现也有一个循序渐进的过程:1.最基本要求:每次从getI ...

  7. sicily 无路可逃?(图的DFS)

    题意:在矩阵数组中搜索两点是否可达 解法:DFS #include<iostream> #include<memory.h> using namespace std; stru ...

  8. [深入React] 2.综述

    在开始本教程前,请先查看官方示例:https://github.com/facebook/react/archive/master.zip 里的 examples 目录. 学习react是一个循序渐进 ...

  9. android后台截屏实现(1)--源码编译

    前段时间接到任务要实现后台截图并上传的功能,在网上查了好久,发现遇到这类问题的人还不少.经过一番对比后发现还是修改并编译源码中的screencap类然后通过JNI来调用这种方法比较可靠,而其他的在ja ...

  10. 【调试技巧】FireFox作为移动端的设置

    1.在地址栏输入“about:config”,按下回车进入设置菜单. 2.找到“general.useragent.override”,如果没有这一项,则点右键“新建”->“字符串”,输入这个字 ...