[ altered ] I had a very strange bug. My debugger used to crash when it calls a function that uses an std::string. I thought this was an error iń my code and at first I didn't realized, that it had to do something with std::strings. Anyway I now know it has to do something with KDevelop, because if I compile this small test file:
#include <iostream>
#include <vector>
#include <string>
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
std::string test = "test test";
std::cout << test;
return 0;
}
It prints "test test" but when I try to debug it, it crashes as well at the call of main() . Anyway, I can debug my project with nemivar, which also uses GDB as backend, with no error.
So this isn't a problem to me anymore and this could be deleted.
In your search_str_in_vector()
function you dereference an end()
iterator which is not allowed and results in undefined behaviour. Your for loop is also one element larger than the vector (start from vector.size()-1
instead).