I wanted to create special class ThreadVector to be able to push_back void class member functions to make them work concurrently. I tried to write the same parameters as thread has but got the error "Package options should be disclosed in this context". What type should parameters have?
class ThreadVector
{
vector<thread> threads;
template <class Fn, class... Args>
void push_back(Fn&& fn, Args&&... args)
{
data.push_back(move(thread(fn, args)));
}
}
template<typename T>
class Class1
{
void function();
}
ThreadVector threadVecrors;
threadVectors.push_back(&Class1<T>::function, this);
Aucun commentaire:
Enregistrer un commentaire