void Set(const K &key, const V &value) { auto i = map.insert(std::make_pair(key, Item(value))); Item &item = i.first->second; item.old = false; if (!i.second) item.value = value; cond.notify_all(); }