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;

}

posted on 2013-08-07 15:34  shoutcharter  阅读(170)  评论(0编辑  收藏  举报

导航