Get coordinates from string in c++ : So I have a string like this(all positive int, no spaces in square brackets):

   

    "[(1,2),(10,4),(5,12),... ]"

And I would like extract int like this: 1,2,10,4,5,12.
I'm now using the following code which does not handle int >=10

               std::istringstream coor(coorstring);
               std::vector<int> num;
               char c;
               while (coor.get(c)){
                if (isdigit(c)){
                    unsigned int a = c - '0';
                    if (a<max) {num.push_back(a);}
                }
               }

For example my current output is `1,2,1,0,4...` rather than `1,2,10,4...` I'm new to c++  and I'm curious what needs to be modified to get the output I want(without using regex)? And by the way, instead of using int vector, what is a good data structure to store these coordinates in c++ for a later use of drawing a graph?