私はstd::string
をboost::lockfree::queue
に入れようとしているので、スレッドは新しいデータで互いに更新できます。std :: stringをboost :: lockfree :: queue(または代替)に入れる方法は?
私はboost::lockfree::queue<std::string> updated_data;
を使用しようとすると、g++
は言う:
In instantiation of 'class boost::lockfree::queue >':
error: static assertion failed: (boost::has_trivial_destructor::value)
error: static assertion failed: (boost::has_trivial_assign::value)
私はshown generally what these errors meanしてきたが、私は、C++に新ほとんどのブランドだと私は、今までにこの自分自身を固定のない希望を持っていません。
lockfree
のスレッド間でテキストデータを渡す別の方法はありますか?そうでない場合はにstd::string
を入れる方法を教えてください。
これはあまり真実ではありません:キューに生のポインタを置いて、ポインタをポップすると解放することができます。例えば、 'queue-> consume_all([std :: string * str){do_something(str); str;});' – Zero