class MyList { private: std::wstring content; std::shared_ptr<MyList> next_element; public: std::shared_ptr<MyList> get_pointer_to_next_element(); const std::wstring &get_content(); void set_content(std::wstring); void set_pointer_to_next_element(const std::wstring &w); MyList(const std::wstring &w); }; bool nil (std::shared_ptr<MyList> l); bool member (const std::wstring &w, std::shared_ptr<MyList> l); void print (std::shared_ptr<MyList> l); std::shared_ptr<MyList> append(const std::wstring &w, std::shared_ptr<MyList> l);
const std::wstring &head (std::shared_ptr l);
liefert das erste Element der Liste l std::shared_ptr<MyList> tail (std::shared_ptr<MyList> l);
entfernt das erste Element der Liste l und liefert die verkürzte Liste l zurück bool nil (std::shared_ptr<MyList> l);
liefert true, wenn die Liste l leer ist Implementieren sie mit Hilfe der Funktionen head, tail und nil folgende Funktionen
bool member (const std::wstring &w, std::shared_ptr<MyList> l);
liefert true, wenn der wstring w in der Liste l vorkommt.void print (std::shared_ptr<MyList> l);
druckt alle Elemente der Liste aus std::shared_ptr<MyList> append (const std::wstring &w, std::shared_ptr<MyList> l);
fügt den wstring w am Ende der Liste an und liefert die Liste als Ergebnis zurück.
class MyList {
private:
std::wstring content;
std::shared_ptr<MyList> next_element;
public:
std::shared_ptr<MyList> get_pointer_to_next_element();
const std::wstring &get_content();
void set_content(std::wstring);
void set_pointer_to_next_element(const std::wstring &w);
MyList(const std::wstring &w);
};
const std::wstring &head (std::shared_ptr<MyList> l);
std::shared_ptr<MyList> tail (std::shared_ptr<MyList> l);
bool nil (std::shared_ptr<MyList> l);
bool member (const std::wstring &w, std::shared_ptr<MyList> l);
void print (std::shared_ptr<MyList> l);
std::shared_ptr<MyList> append(const std::wstring &w, std::shared_ptr<MyList> l);