Could you, please, help me to figure out the right syntax of how to emplace
into an std::unordered_map
a value containing an std::mutex
?
Here is an example:
#include <mutex>
#include <unordered_map>
using SubMap = std::unordered_map<int, float>;
struct MutexedSubMap{ std::mutex mutex; SubMap subMap; };
std::unordered_map<int, MutexedSubMap> m;
// The following do not work:
// m.emplace(7, MutexedSubMap{});
// m.emplace(7);
// m.emplace(7, {});