C++\'s std::mutex does not have a move constructor. There is a good reason for that. Basically, move constructors themselves are not generally thread safe, and
The mutex does not require to be moved:
Imagine that every row in your map is like:
template
class row
{
shared_ptr m;
T data;
...
};
So if your row need to be moved or copied, there is no problem.
Then, you may access the mutex from every process to access the data.
Of course, you need a global mutex to perform changes on the whole map: insert / delete / [] / any other operation that change the state of the map.
EDITED:
Following a simple example of code with a mutex in every row. (It does not implement anything else that just the data structure)
#include
#include