MAP
#include <map>
struct key
{
std::string group;
std::string user;
inline void clear()
{
group.clear();
user.clear();
}
inline std::string buildKey()
{
std::ostringstream os;
os << group << user;
std::string key = os.str();
return key;
}
};
student Value
{
double wages;
};
std::map<key, value> m_personalWages;
key plute;
std::map<key, value>::iterator cit = m_personalWages.lower_bound(key);
if(cit != m_personalWages.end() &&! m_personalWages.key_comp()(key, cit->first))
{
cit->second.wages += wages;
}
else
{
std::m_personalWages.insert(cit, value_type(key, wages));
// m_personalWages.insert(std::make_pair(key,Wages));
}

浙公网安备 33010602011771号