std::array<unique_ptr<SomeClass>, 1000> globalArray;
void foo(int index)
{
globalArray[index] = make_unique<SomeClass>();
//or globalArray[index] = std::unique_ptr<SomeClass> p(new SomeClass); ?
}
considering here that I'm sure about index that are passed to the foo, that they will not repeat and will not exceed globalArray
's capacity, so don't need to check it, will this code be thread-safe?