boost库提供标准的C++ API 配合dev c++使用,功能更加强大
源代码在线查看: function_output_iterator_eg.rst
Example
.......
::
struct string_appender
{
string_appender(std::string& s)
: m_str(&s)
{}
void operator()(const std::string& x) const
{
*m_str += x;
}
std::string* m_str;
};
int main(int, char*[])
{
std::vector x;
x.push_back("hello");
x.push_back(" ");
x.push_back("world");
x.push_back("!");
std::string s = "";
std::copy(x.begin(), x.end(),
boost::make_function_output_iterator(string_appender(s)));
std::cout
return 0;
}