#include using namespace std; template bool GetValueFromMap( const map &m, const U &key, V &val ) { map::const_iterator iter = m.find(key); if( iter == m.end() ) return false; val = iter->second; return true; }