I am attempting to create a doubly linked list and use a function which accepts a value passed by reference. However, when I try to access the value it throws an error. I am getting the "error: lvalue required as left operand of assignment &da= NULL;"
I have tried:
#ifndef __DOUBLYLINKEDLIST_H__
#define __DOUBLYLINKEDLIST_H__
//
//
#include
#include
using namespace std;
class DoublyLinkedList {
public:
DoublyLinkedList();
~DoublyLinkedList();
void append (const string& s);
void insertBefore (const string& s);
void insertAfter (const string& s);
void remove (const string& s);
bool empty();
void begin();
void end();
bool next();
bool prev();
bool find(const string& s);
const std::string& getData() const;
private:
class Node
{
public:
Node();
Node(const string& data);
~Node();
Node* next;
Node* prev;
string* data;
};
Node* head;
Node* tail;
Node* current;
};
DoublyLinkedList::Node::Node(const string& da)
{
this->data=nullptr;
this->next=nullptr;
this->prev=nullptr;
&da= NULL;
}