You can achieve what you want with the following
template <typename Key, typename Value, typename K>
bool hasKey(const std::map<Key, Value>& mp, const K& k) {
return mp.find(k) != mp.end();
}
Thus, you are sure, looking at the declaration of the function, that not a single operand will be changed, since they are references to const.
non-const const ( rvalues) .find() std::map. , .find() const, , , , .
, , - ( ++ 14, . http://en.cppreference.com/w/cpp/container/map/find), , ?.