2
我想這是我第一次在這裏找不到已經回答了的問題,如果有人成功使用boost coroutine2 lib而沒有使用lambdas,我真的可以使用一些幫助。 我的問題,sumarized:使用升級協程2而不使用lambdas
class worker {
...
void import_data(boost::coroutines2::coroutine
<boost::variant<long, long long, double, std::string> >::push_type& sink) {
...
sink(stol(fieldbuffer));
...
sink(stod(fieldbuffer));
...
sink(fieldbuffer); //Fieldbuffer is a std::string
}
};
我打算用這從另一個類中的協同程序,有將每個產生價值在它的地方的任務,所以我試圖實例化一個對象:
worker _data_loader;
boost::coroutines2::coroutine<boost::variant<long, long long, double, string>>::pull_type _fieldloader
(boost::bind(&worker::import_data, &_data_loader));
但不會編譯:
/usr/include/boost/bind/mem_fn.hpp:342:23:
error: invalid use of non-static member function of type
‘void (worker::)(boost::coroutines2::detail::push_coroutine<boost::variant<long int, long long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)’
有人能擺脫任何光線在這個問題?