I'm dealing with a file with a linked list of lines with each node looking like this:
struct TextLine{
//The actual text
string text;
//The line number of the document
int line_num;
//A pointer to the next line
TextLine * next;
};
and I'm writing a function that adds spaces at the beginning of the lines found in the variable text
, by calling functions like linelist_ptr->text.insert(0,1,'\t');
The program compiles, but when I run it I get this error:
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at
Aborted
Any ideas?