Error trying printing a graph C++.
I'm trying to print a graph with a toString() function, where basically the graph is a vector<Edge *>. My idea is to iterate in each element and print its element as a string. But is not working... Here is the code. https://code.sololearn.com/cH3RyaoSp3yM The error I'm getting is this: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped) And using a sanitize, it points to the lines 84 and 106. I have the feeling that maybe I can solve it if I allocate memory dynamically, but in this point I'm not sure if that is the solution (and what element I should allocate). I don't know what to do to solve the problem.