/************************************ * file enc : ascii * author : wuyanyi09@gmail.com ************************************/ #ifndef LIMONP_MAP_FUNCTS_H #define LIMONP_MAP_FUNCTS_H #include #include #include #include #include #define HashMap std::unordered_map namespace Limonp { using namespace std; template vT getMap(const map& mp, const kT & key, const vT & defaultVal) { typename map::const_iterator it; it = mp.find(key); if(mp.end() == it) { return defaultVal; } return it->second; } template void map2Vec(const map& mp, vector > & res) { typename map::const_iterator it = mp.begin(); for(; it != mp.end(); it++) { res.push_back(*it); } } } #endif