If I have a function that only do emplace_back or push_back on a global vector with unique_ptr as a values, will it be thread-safe or I have to use mutexes?
void (T param)
{
globalVector.emplace_back(std::make_unique<T>(param));
//or globalVector.push_back (std::make_unique<T>(param));
}
And if it only be vector of T?
void (T param)
{
globalVector.emplace_back(param);
//or globalVector.push_back (param);
}
Aucun commentaire:
Enregistrer un commentaire