Does anyone know why the following code segfaults? Valgrind gives me no hints.
I compile with 'g++ knas.cpp -pedantic -Wall -ansi -g -o knas' and get no errors/warnings.
Code:#include <algorithm> #include <vector> #include <string> int main() { std::string str = "hello"; std::vector<char> vec; copy(str.begin(), str.end(), vec.begin()); return 0; }