StringStream

  • + 0 comments
     vector<int> res;
        stringstream ss(str);
        int num;
        char comma;
        while(ss>>num)
        {
            res.push_back(num);
            ss>>comma;
        }
        return res;