64,643
社区成员
发帖
与我相关
我的任务
分享
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
void doPrint(string & s)
{
cout <<s.c_str() <<" " <<endl;
}
int main(int argc, char* argv[])
{
deque <string> coll;
coll.assign (3, string("string"));
coll.push_back ("last string");
coll.push_front ("first string");
for_each(coll.begin(), coll.end(), doPrint);
return 0;
}
#include <string>