私はこの単純なクラスを持っています:
struct Worker
{
Worker() : done{false} {}
Worker(const Worker& rhs) : done{rhs.done}, qworker{} {}
Worker(Worker &&rhs) : done{rhs.done}
{
qworker = std::move(rhs.qworker);
}
...
}
これは gcc-4.7.2 で正常にコンパイルされますが、このバージョンを使用しようとするとエラーが発生します
struct Worker
{
Worker() : done{false} {}
Worker(const Worker& rhs) : done{rhs.done}, qworker{} {}
Worker(Worker &&rhs) : done{rhs.done}
, qworker{std::move(rhs.qworker)} // <- ERROR
{
}
...
}
なんで?
In file included from tlog.cpp:8:0:
log11.hpp: In member function ‘void Log11::Worker::run()’:
log11.hpp:34:29: error: ‘class std::vector<std::function<void()> >’ has no member named ‘pop_front’
In file included from /usr/include/c++/4.7/thread:39:0,
from tlog.cpp:3:
/usr/include/c++/4.7/functional: In instantiation of ‘static void std::_Function_handler<void(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes ...) [with _Functor = std::vector<std::function<void()> >; _ArgTypes = {}]’:
/usr/include/c++/4.7/functional:2298:6: required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor, typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type) [with _Functor = std::vector<std::function<void()> >; _Res = void; _ArgTypes = {}; typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type = std::function<void()>::_Useless]’
log11.hpp:20:78: required from here
/usr/include/c++/4.7/functional:1926:2: error: no match for call to ‘(std::vector<std::function<void()> >) ()’