Timeline for Linked list with iterators
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 7, 2014 at 10:57 | history | edited | Edward | CC BY-SA 3.0 |
fixed answer per comment by ruds
|
Jul 7, 2014 at 10:55 | comment | added | Edward | @ruds: rereading what I wrote there, I'm inclined to agree with you. There are other problems with the code but this isn't one of them. I have amended my answer. Thanks. | |
Jul 7, 2014 at 6:03 | comment | added | ruds |
I'm confused by your advice about operator*() const , which you suggest should return a copy of the value; you say that return p->data; creates a temporary of some sort. It would be unusual to return a copy here, and undesirable whenever T is large. The lifetime of p->data shouldn't be an issue; it is normal for iterators to be invalidated (i.e. it is undefined behavior to use them) when e.g. the collection they iterate over is destroyed.
|
|
Jul 6, 2014 at 13:27 | history | edited | Edward | CC BY-SA 3.0 |
added a few more points
|
Jul 4, 2014 at 22:40 | history | answered | Edward | CC BY-SA 3.0 |