I would like create class with variadic number of mutexes. And now, I would like to my class can store mutexes as fields, so:
template<typename... Ts>
class NMutexesAsOne {
private:
std::tuple<Ts&...> tuple;
public:
NMutexesAsOne(Ts&... mutexes){
tuple = std::make_tuple(mutexes...);
}
};
But, it is very important to class ( object) has references to mutexes, so, in fact without templates it would look like:
template<typename... Ts>
class NMutexesAsOne {
private:
std::mutex& m1;
std::mutex& m2;
std::mutex& m3;
std::mutex& m4;
....
};
But, I know that there are a lot of issues with type deduction especially with reference and templates. So, I am asking to help me :)
Aucun commentaire:
Enregistrer un commentaire