Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (x == begin()) {
- cout << "Удалить первый узел";
- }
- for (Node* i = begin(); i->next != end(); i=i->next) {
- Node* tmp = i->next;
- if (tmp && tmp == x) {
- i->next = i->next->next;
- delete tmp;
- }
- }
- avp@avp-ubu1:hashcode$ g++ huxilist.cpp
- huxilist.cpp: In copy constructor ‘List::List(const List&)’:
- huxilist.cpp:16:47: error: passing ‘const List’ as ‘this’ argument of ‘List::Node* List::begin()’ discards qualifiers [-fpermissive]
- huxilist.cpp:16:60: error: passing ‘const List’ as ‘this’ argument of ‘List::Node* List::end()’ discards qualifiers [-fpermissive]
- huxilist.cpp: In member function ‘List& List::operator=(const List&)’:
- huxilist.cpp:37:27: error: passing ‘const List’ as ‘this’ argument of ‘List::Node* List::begin()’ discards qualifiers [-fpermissive]
- huxilist.cpp:37:40: error: passing ‘const List’ as ‘this’ argument of ‘List::Node* List::end()’ discards qualifiers [-fpermissive]
- huxilist.cpp: In function ‘int main()’:
- huxilist.cpp:114:9: error: ‘List_m’ has not been declared
- huxilist.cpp:114:23: error: ‘it1’ was not declared in this scope
- huxilist.cpp:114:29: error: ‘listfile’ was not declared in this scope
- avp@avp-ubu1:hashcode$
- int delete_node (Node *x) {
- if (!x || !head)
- return -1;
- if (x == head) {
- head = x->next;
- delete x;
- return 0;
- }
- for (Node *t = head; t; t = t->next)
- if (t->next == x) {
- t->next = x->next;
- delete x;
- return 0;
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement