00001 #ifndef __MGFP_INCLUDE_UTILS_H__
00002 #define __MGFP_INCLUDE_UTILS_H__
00003
00004 #include <mgfp/config.h>
00005
00006 namespace mgf
00007 {
00008
00013 template <class T>
00014 typename T::mapped_type existsOrEmpty(T map, typename T::key_type key)
00015 {
00016 typename T::iterator i = map.find(key);
00017 if (i != map.end()) {
00018 return i->second;
00019 }
00020 else {
00021 return typename T::mapped_type();
00022 }
00023 }
00024
00025 }
00026
00027 #endif
00028