私は、各ノードが次のように見える行のリンクリストを持つファイルを扱っています:
struct TextLine{
//The actual text
string text;
//The line number of the document
int line_num;
//A pointer to the next line
TextLine * next;
};
text
そして、次のような関数を呼び出して、変数で見つかった行の先頭にスペースを追加する関数を書いていますlinelist_ptr->text.insert(0,1,'\t');
プログラムはコンパイルされますが、実行すると次のエラーが発生します。
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at
Aborted
何か案は?