简体   繁体   English

Boost :: Lambda中的ref()?

[英]ref() in Boost::Lambda?

What is the equivalent of Boost::Phoenix's ref in Boost::Lambda? Boost :: Lambda中的Boost :: Phoenix ref相当于什么? I can't find it in the online docs. 我在在线文档中找不到它。

#include <algorithm>
#include <string>
#include <boost/lambda/bind.hpp>
using namespace boost::lambda;

int main()
{
    std::string a, b;
    std::for_each(b.begin(), b.end(), ref(a) += _1);  // how do I do this?
}

boost::ref and boost::lambda::var don't seem to work (they don't have the operator overloads, apparently). boost::refboost::lambda::var似乎不起作用(它们显然没有运算符重载)。

D'oh, I just figured it out... 天哪,我只是想通了...

Just #include <boost/lambda/lambda.hpp> and then var will work! 只需#include <boost/lambda/lambda.hpp> ,然后var就可以了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM