basic_string::_M_construct null not valid after constructing subvector of strings

The chunk vector ceases to exist at the end of the for loop body. It’s still referenced by some thread. That’s called a dangling reference, and it’s not good.

The error that you see may however be related to Result. Its definition isn’t provided (at the time of writing this answer) so it’s difficult to say. Remember that as the one who’s asking what’s wrong with the code, probably aren’t qualified to decide what’s important or not to show.

Leave a Comment