If I have an ostringstream that contains various numbers separated by -
(That's: space - space btw)
Could I extract each number individually?
If I have an ostringstream that contains various numbers separated by -
(That's: space - space btw)
Could I extract each number individually?
 
    
    use one of spiting functions from here: Split a string in C++? storing them as strings inside std::vector, then use std::stoi (or equivalent) which parses string to integer , surrounding each call with try / catch.
example (after splitting):
for (int i = 0; i < arrayOfStrings.size(); i++)
{
    try
    {
        int myInt = std::stoi(arrayOfStrings[i]);
    }
    catch (std::exception& e)
    {
        std::cout<<e.what()<<"\n";
    }
}
 
    
     
    
    Something like this may work....
#include <boost/algorithm/string.hpp>
std::vector<int> ints;
boost::split(ints, " - ",std::stoi (stream.str()));
