map_utils.hpp

Go to the documentation of this file.
00001 #ifndef MAP_UTILS_HPP_INCLUDED
00002 #define MAP_UTILS_HPP_INCLUDED
00003 
00004 #include <map>
00005 
00006 template<typename K, typename V>
00007 const V& map_get_value_default(const std::map<K,V>& m, const K& key, const V& val) {
00008     typename std::map<K,V>::const_iterator i = m.find(key);
00009     if(i != m.end()) {
00010         return i->second;
00011     } else {
00012         return val;
00013     }
00014 }
00015 
00016 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs