for_each 用法!
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 用法!的更多相关文章
- 匿名函数和for_each用法
匿名函数,C++11的 for_each 用法 #include <iostream> #include <algorithm> #include "testClas ...
- for_each用法
for_each()是个function template #include <algorithm>头文件说明 template<class _InIt, class _Fn1> ...
- CPP STL学习笔记
STL的概念 源地址 https://www.ev0l.art/index.php/archives/15/ <li> Iterator (迭代器)<li> Containe ...
- 《STL源码剖析》学习半生记:第一章小结与反思
不学STL,无以立.--陈轶阳 从1.1节到1.8节大部分都是从各方面介绍STL, 包括历史之类的(大致上是这样,因为实在看不下去我就直接略到了1.9节(其实还有一点1.8.3的内容)). 第一章里比 ...
- c++11的for新用法 (重新练习一下for_each)
看到手册的代码里面有个for的很奇怪的用法,用了一把 http://www.cplusplus.com/reference/unordered_set/unordered_set/insert/ ...
- C++11之for循环的新用法
C++使用如下方法遍历一个容器: #include "stdafx.h" #include<iostream> #include<vector> int m ...
- STL vector用法介绍
STL vector用法介绍 介绍 这篇文章的目的是为了介绍std::vector,如何恰当地使用它们的成员函数等操作.本文中还讨论了条件函数和函数指针在迭代算法中使用,如在remove_if()和f ...
- c++ bind1st 和 bind2nd的用法
std::bind1st 和 std::bind2nd将二元函数转换为一元函数,具体用法参加下面的代码. 代码介绍了两种使用方式,第一种是使用std::less和std::greater,第二种是使用 ...
- c++ algorithm 的用法
1 , accumulate()template<class _II, class _Ty> inline_Ty accumulate(_II _F, _II _L, _Ty _V){fo ...
随机推荐
- eclipse中格式化代码快捷键Ctrl+Shift+F失效的解决办法
很长一段时间我的eclipse都有个毛病,就是当我要格式化代码的时候,右键-source-format能够起效,但ctrl+shift+f不好使了. 可以基本断定是快捷键与别的软件冲突了,但一直也没时 ...
- HDOJ 1163 Eddy's digital Roots(九余数定理的应用)
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
- Angular.js VS. Ember.js:谁将成为Web开发的新宠?
这篇博文陈述的非常好,比较全面的剖析了Angular.js与Ember.js,下面的链接,供学习与参考: http://www.csdn.net/article/2013-09-09/2816880- ...
- 移动web app开发框架
文章地址:http://www.cnblogs.com/soulaz/p/5586787.html jQuery Mobile jQuery Mobile框架能够帮助你快速开发出支持多种移动设备的Mo ...
- PHP各版本之间差异
PHP5.3 __toString 魔术方法不再接受参数. 魔术方法 __get, __set, __isset, __unset, and __call 应该总是公共的(public)且不能是静态的 ...
- error in Swift. “Consecutive Declarations On A Line Must Be Separated By ';'”
当输入的时候以上代码的时候出现这个错误,经过尝试发现条件表达式?前面应该有一个空格 不然会和swift中的?和 !混淆
- 用java实现Simsimi小黄鸡接口
package com.iask.webchat.chatmachine; import java.io.BufferedReader; import java.io.InputStream; imp ...
- python数据库做成邮箱的注册系统!
#! /usr/bin/env python2.7 # -*- coding:utf-8 -*- #File:w7.py #Date:2013-7-18 #Author:wangyu import r ...
- js过滤空格
点击查看效果 点击进入下载 <html> <head> <title> 过滤空格 </title> <SCRIPT LANGUAGE=" ...
- laravel敏捷应用
App Category Recipes dealing with Laravel's App facade Checking Your Environment Checking if You're ...