Hi, so I'm working on a project that requires me to add new nodes to a linked list that I can use to add and remove nodes from the beginning and end of the list. Right now I keep getting a memory error when I try to run my insertAsLast function. My program will crash on one line in particular. I'm pretty sure the line of code is correct, but I can't figure out what is causing the problem. The error I get in the debugger is that it is unable to read the memory of _entry and _next, and _last is <NULL>. The debugger says "Access location violation" or something to that effect. This does not happen with my insertAsFirst function, so I'm not sure what is different.
If _last is the last node with a value == nullptr this line should be transformed _last->_next = new Node(x, nullptr); //Problem line
to _last= new Node(x, nullptr);
Also am in doubt of your clone function, if you really have to allow copy semantics on your class then i bet you'd rather change that definition of you class cnstor to copying the values themselves else objects that are copies of others will be invalidated when the ~dstructor is run on any one of them;