std::out_of_range error?

Posted by vette982 on Stack Overflow See other posts from Stack Overflow or by vette982
Published on 2010-05-27T03:24:25Z Indexed on 2010/05/27 3:31 UTC
Read the original article Hit count: 181

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?

© Stack Overflow or respective owner

Related posts about c++

Related posts about string