开源的东西很赞,仔细看下文档就能用。
// Shell.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
return 0;
}
使用Boost与Lambda处理输入
本文介绍了一个使用C++ Boost库结合Lambda表达式处理标准输入的例子。通过简单的代码实现,展示了如何读取整数并将其乘以三后输出。涉及的技术包括Boost库的引入、Lambda表达式的使用以及迭代器的应用。
764

被折叠的 条评论
为什么被折叠?



