// $Id$ #ifndef _utl_MustFind_h_ #define _utl_MustFind_h_ #include #include namespace utl { template inline typename Map::mapped_type& MustFind(Map& map, const typename Map::key_type& key, const std::string& failMessage) { const typename Map::iterator it = map.find(key); if (it != map.end()) return it->second; ERROR(failMessage); throw NonExistentComponentException(failMessage); } template inline const typename Map::mapped_type& MustFind(const Map& map, const typename Map::key_type& key, const std::string& failMessage) { const typename Map::const_iterator it = map.find(key); if (it != map.end()) return it->second; ERROR(failMessage); throw NonExistentComponentException(failMessage); } template inline typename Map::mapped_type& MustFind(Map* const map, const typename Map::key_type& key, const std::string& failMessage) { if (map) { const typename Map::iterator it = map->find(key); if (it != map->end()) return it->second; } ERROR(failMessage); throw NonExistentComponentException(failMessage); } template inline const typename Map::mapped_type& MustFind(const Map* const map, const typename Map::key_type& key, const std::string& failMessage) { if (map) { const typename Map::const_iterator it = map->find(key); if (it != map->end()) return it->second; } ERROR(failMessage); throw NonExistentComponentException(failMessage); } } #endif