I have an error and would like tips to solve it
I have my Node struct inside the DLList class:
struct Node
{
Type m_data;
Node *m_next, *m_prev;
Node(Type& v, Node* _prev) : m_data(v), m_prev(_prev), m_next(nullptr) {}
};
Node *m_head, *m_tail;
int m_size;
And the function:
template<typename Type>
void DLList<Type>::addHead(const Type& v)
{
Node* node = new Node(v, m_head);
node->m_data = v;
node->m_next = m_head;
m_head = node;
++m_size;
}
But when creating the Node * node passing the parameters, the compiler is returning this error: : can not convert argument 1 from 'const std :: string' to 'std :: string &'
The parameters passed, are coming from main ():
DLList<string> list;
DLList<string> list2;
DLList<string>* list3;
DLLIter<string> iter(list);
DLList<int>* testPointer;