terminate called after throwing an instance of stdout_of_range what basic_stringsubstr __pos which is 4 this-size which is 0
This error message is indicating that your code is trying to access a substring of a string that is out of range.
In this specific case, the error is caused by trying to call the substr function on an empty string (this->size() returns 0), but specifying a starting position of 4 (__pos is 4). Since the string is empty, any starting position greater than 0 will be out of range, resulting in the error.
To fix this issue, you need to ensure that the string you are working with is not empty before calling substr. You can do this by checking the size of the string before calling the function or by using an if statement to handle the empty string case separately
原文地址: https://www.cveoy.top/t/topic/hYJI 著作权归作者所有。请勿转载和采集!