0
I have a mistake and would like tips to fix 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 Node* Node by passing the parameters, the compiler is returning this error:
'Dllist::Node::Node(Dllist::Node &&)': cannot 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;