Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 是否有一个单输入、二进制输出的stdlib或boost函数可以绑定? bool all_ok=boost::algorithm::all_of(info.begin(),threadInfo.end(),[&](std::pair const&p){return p.second.am_ok;});_C++_Boost - Fatal编程技术网

C++ 是否有一个单输入、二进制输出的stdlib或boost函数可以绑定? bool all_ok=boost::algorithm::all_of(info.begin(),threadInfo.end(),[&](std::pair const&p){return p.second.am_ok;});

C++ 是否有一个单输入、二进制输出的stdlib或boost函数可以绑定? bool all_ok=boost::algorithm::all_of(info.begin(),threadInfo.end(),[&](std::pair const&p){return p.second.am_ok;});,c++,boost,C++,Boost,上面是我试图从中删除c++11的一行代码(如果您必须知道的话,为了与我正在集成的应用程序兼容)。我希望在不定义当前方法外部的函数的情况下替换lambda 我的问题是,如何利用boost::bind来表示接受单个输入并返回布尔值的函数&绑定?如果您真的想使用boost::bind来实现这一点,它看起来会像这样: bool all_ok = boost::algorithm::all_of(info.begin(), threadInfo.end(), [&](std::pair<st

上面是我试图从中删除c++11的一行代码(如果您必须知道的话,为了与我正在集成的应用程序兼容)。我希望在不定义当前方法外部的函数的情况下替换lambda


我的问题是,如何利用boost::bind来表示接受单个输入并返回布尔值的函数&绑定?

如果您真的想使用
boost::bind
来实现这一点,它看起来会像这样:

bool all_ok = boost::algorithm::all_of(info.begin(), threadInfo.end(), [&](std::pair<std::string, Info> const &p){ return p.second.am_ok; });
这是怎么回事:(为了替换部分lambda,还有更多的东西要做)
boost::bind(&Info::am_ok, boost::bind(&std::pair<std::string, Info>::second, _1));
struct is_ok
{
    typedef bool result_type;
    result_type operator() (std::pair<std::string, Info> const &p) const
    {
        return p.second.am_ok;
    }
};