run
に他のすべてのタプル要素を使用したいので、これを行う必要があります。基本的に、私はこれらのタプルのベクトルを持っていて、ある種のテーブルを形成しています。私はこれを正しく行う方法を自分自身を理解することができませんでした。タプル内のunique_ptrに新しい値を代入/移動することはできますか?
編集:明らかに前の簡略化されたコードは異なるエラーを示しているので、無視してください。ここのコードは、私が自分のコードでどのように持っているかです。 (申し訳ありませんが)
class GUI {
using win_t = std::tuple<sf::RenderWindow&, Container&, std::unique_ptr<std::thread>, std::condition_variable>;
enum { WINDOW, CONT, THREAD, CV }
std::vector<win_t> windows;
void run(win_t &win);
win_t &addWindow(sf::RenderWindow & window, Container & c) {
windows.emplace_back(std::forward_as_tuple(window, c, nullptr, std::condition_variable()));
win_t &entry = windows.back();
std::get<GUI::THREAD>(entry) = std::make_unique<std::thread>(&GUI::run, this, entry); // error is on this line
return entry;
}
}
そして、私は取得していますエラー:
Error C2280 'std::tuple<sf::RenderWindow &,Container &,std::unique_ptr<std::thread,std::default_delete<_Ty>>,std::condition_variable>::tuple(const std::tuple<sf::RenderWindow &,Container &,std::unique_ptr<_Ty,std::default_delete<_Ty>>,std::condition_variable> &)': attempting to reference a deleted function dpomodorivs c:\program files (x86)\microsoft visual studio 14.0\vc\include\tuple 75`
あなたは上記を試してみましたか?何が悪かったのか? – Yakk
[mcve]を入力し、発生したエラーの内容を入力してください。 – Barry
申し訳ありません。これは今より良いですか? – snowflake