对不起,混淆标题。让我通过代码解释:boost :: function&boost :: lambda - 调用网站调用和访问_1和_2作为类型
#include <string>
#include <boost\function.hpp>
#include <boost\lambda\lambda.hpp>
#include <iostream>
int main()
{
using namespace boost::lambda;
boost::function<std::string(std::string, std::string)> f =
_1.append(_2);
std::string s = f("Hello", "There");
std::cout << s;
return 0;
}
我试图用function
来创建使用labda表达式来创建一个新的返回值的函数,并调用该函数的调用点,s = f("Hello", "There");
当我编译,我得到:
1>------ Build started: Project: hacks, Configuration: Debug x64 ------
1>Compiling...
1>main.cpp
1>.\main.cpp(11) : error C2039: 'append' : is not a member of 'boost::lambda::lambda_functor<T>'
1> with
1> [
1> T=boost::lambda::placeholder<1>
1> ]
使用MSVC 9
我的基本认识210和lambda
可能缺乏。今天上午的教程和文档没有帮助。
我该怎么做我想做的事?
+1 Thanks 6more – 2010-06-05 19:10:57