void ppk::readLabel(std::string &src, std::map < std::string, std::vector<int>> &dst)
{
dst.clear();
std::vector<std::string> vstr;
split(src, vstr, " ");
if (vstr.size() != 9)
{
std::cout << "readLabel wrong line!" << std::endl;
return;
}
std::vector<int> temp;
std::vector<std::string>::iterator it;
for (it = vstr.begin() + 1; it != vstr.end(); it++)
{
temp.push_back(stoi(*it));
}
dst[vstr[0]] = temp;
}
void ppk::split(std::string &src, std::vector<std::string> &dst, std::string sep)
{
std::string::size_type pos;
dst.clear();//如果dst有内容,先清除
src += sep;//扩展字符串
int size = src.size();
for (int i = 0; i < size; i++)
{
pos = src.find(sep, i);
if (i< pos)dst.push_back(src.substr(i, pos - i));
i = pos + sep.size() - 1;
}
}