C++ STL map - conditional return
I'm looking for an elegant replacement to:

    if (MyMap.count(x)) return MyMap[x];

While this code does what I want -- it returns an entry if one exists -- in the case where the element does exist, it searches the map twice. Is there a more elegant way?
C++ STL map - conditional return
===

I'm looking for an elegant replacement to:

    if (MyMap.count(x)) return MyMap[x];

While this code does what I want -- it returns an entry if one exists -- in the case where the element does exist, it searches the map twice. Is there a more elegant way?