我应该看到std :: bind和boost :: bind之间的显着差异吗? [英] Should I be seeing significant differences between std::bind and boost::bind?

查看:434
本文介绍了我应该看到std :: bind和boost :: bind之间的显着差异吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在g ++的4.7分支上探索对C ++ 11的支持(Ubuntu / Linaro 4.7.3-2ubuntu〜12.04,具体),我似乎发现了差异。特别是,如果我在Boost ASIO异步客户端示例中注释掉boost / bind.hpp的#include并系统地替换boost :: bind与std :: bind的出现(取自 http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/ example / http / client / async_client.cpp ),程序不再编译。对此有任何解释吗?

I'm exploring the support for C++11 on the 4.7 branch of g++ (Ubuntu/Linaro 4.7.3-2ubuntu~12.04, to be specific) and I seem to be finding differences. In particular, if I comment out the #include of boost/bind.hpp and systematically replace occurrences of boost::bind with std::bind in the Boost ASIO async client example (taken from http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/http/client/async_client.cpp), the program no longer compiles. Any explanation for this?

推荐答案

#include <functional>
namespace boost {
    namespace asio {
        namespace stdplaceholders {
            static decltype ( :: std :: placeholders :: _1 ) & error = :: std :: placeholders :: _1;
            static decltype ( :: std :: placeholders :: _2 ) & bytes_transferred = :: std :: placeholders :: _2;
            static decltype ( :: std :: placeholders :: _2 ) & iterator = :: std :: placeholders :: _2;
            static decltype ( :: std :: placeholders :: _2 ) & signal_number = :: std :: placeholders :: _2;
        }
    }
}

并使用 boost :: asio :: stdplaceholders :: * 而不是 boost :: asio :: placeholders :: *

这篇关于我应该看到std :: bind和boost :: bind之间的显着差异吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆