std::cout << "Hello World!" << std::endl;
std::unordered_map<int, std::unique_ptr<Obj>> map;
// insert -- done with single thread and before find()
map = std::move( std::unique_ptr<Obj>(new Obj) );
// find -- run from multiple threads
auto search = map.find(123); // <=== (Q)
if (search != map.end())
find(), nor any other method in the unordered map is thread safe. If it's possible for one execution thread to call
find() while any other thread calls any unordered map method that modifies it, this results in undefined behavior.
If multiple execution threads are calling
find() with the same key, provided that there is no undefined behavior all execution threads will get the same value for that key.