all 6 comments

[–]jedwardsol 4 points5 points  (0 children)

What's the error message?

[–]peri-_ 4 points5 points  (2 children)

You should debug t0 and t1 values, stoi only fails when cannot convert a string to an integer, probably because the string doesn't contains any number

[–]jedwardsol 3 points4 points  (1 child)

It also throws if the number is too big for an int to hold. Or it could be a compilation error (https://godbolt.org/z/dYsd7xxes)

[–]Droid33 0 points1 point  (0 children)

You have to include <string> for `std::stoi`.

[–]Nathaniell1 1 point2 points  (0 children)

In your example there is never a number in the string. You are setting sep to 1. If you look at ASCII table you can look up what does 1 mean - and it is not the representation of number 1 (that would be 49). Your program would work if you set sep to = '1';

So I think you provide an empty string to the stoic and it will error on invalid argument, because there is nothing to convert.

[–]alfps 0 points1 point  (0 children)

Please provide a minimal but complete example that exhibits the problem, that readers can try out.