50-3.cpp
来自「effective stl 源代码 code」· C++ 代码 · 共 36 行
CPP
36 行
//
// A third example from ESTL Item 50
//
#include <string>
#include <vector>
#include <iostream>
#include "ESTLUtil.h"
using namespace std;
class Widget {
public:
//...
int readStream(istream& stream); // readStream takes
//... // its parameter by
}; // reference
int main()
{
using namespace std;
using namespace ESTLUtils;
vector<Widget*> vw;
for_each( // most STL platforms
vw.begin(), vw.end(), // try to generate a
bind2nd(mem_fun(&Widget::readStream), cin) // reference to a
); // reference in this
// call; such code
// won't compile
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?