Sto cercando la mia propria implementazione lista concatenata in C++ e non posso per la vita di me capire perché sto avendo questo errore. So che esiste un'implementazione STL ma per ragioni che sto cercando di fare da solo. Ecco il codice:Visual Studio 2015 "la sintassi non standard; usare 'e' di creare un puntatore a membro"
#include <iostream>
template <class T>
class ListElement {
public:
ListElement(const T &value) : next(NULL), data(value) {}
~ListElement() {}
ListElement *getNext() { return next; }
const T& value() const { return value; }
void setNext(ListElement *elem) { next = elem; }
void setValue(const T& value) { data = value; }
private:
ListElement* next;
T data;
};
int main()
{
ListElement<int> *node = new ListElement<int>(5);
node->setValue(6);
std::cout << node->value(); // ERROR
return 0;
}
sulla linea specificata, ottengo l'errore "Sintassi non standard; usare '&' per creare un puntatore a membro". cosa diavolo significa?
Wow ..... andare a dormire per me –
@LawrenceAiello Buona fortuna. :) – songyuanyao