我有两个功能: 1. A & DataSource(); 2. 无效数据消费者(A *);
我想要实现的目标:使用一个语句将它们组装成一个 functor。
我努力了:
1. boost::function< void()> func( boost::bind( DataConsumer, & boost::bind( DataSource ) ) );
当然它没有用,编译器说它不能将 'boost::_bi::bind_t ' 转换为 'A *'
2. boost::function<void()> func( boost::bind( DataConsumer, boost::addressof( boost::bind( DataSource ) ) ));
编译器说不能将参数 1 从 'boost::_bi::bind_t' 转换为 'A &'
问题:如何使用嵌套 boost::bind 的返回值?或者如果你想使用 boost::lambda::bind。