So I inputted bunch of strings into a linkedlist. I tend try to input these nodes into vector. But program just kept crashing whenever I try to push_back. Here is my code. I have two class, node and heap.
heap h;
vector<Node> *vstring;
After trying Dennis solution, I was able to fixed the problem. However I am having an another problem. To test if the content is actually in the vector
for(int i = 0; i < size; i++)
{
cout << "content is " << h[i] << endl;
}
I get this following error. error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and 'std::vector') cout << *h << endl; ^ In node class, I do have the << operator overloaded.
ostream& operator<<(ostream& out, const Node &n)
{
cout << "in operator " << endl;
out<<n.data;
return out;
}
vector<Node> myvec
– Neil Kirk