bool cmp(const char& a)
{
static std::string space("\":,{}");
if(std::find(space.begin(), space.end(), a) != space.end())
{
return true;
}
return false;
}
map<string, float> cvt_str2map(string& str)
{
replace_if(str.begin(), str.end(), cmp, ' ');
stringstream ss(str);
map<string, float> result;
while(!ss.eof())
{
pair<string, float>p;
ss >> p.first;
ss >> p.second;
result.insert(p);
}
return result;
}