Timeline for C++ linkedlist with static next/prev pointers
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 9, 2018 at 4:49 | vote | accept | unalignedmemoryaccess | ||
| Jul 9, 2018 at 4:48 | comment | added | Heslacher | I have rolled back your last edit. Please do not update the code in your question to incorporate feedback from answers, doing so goes against the Question + Answer style of Code Review. This is not a forum where you should keep the most updated version in your question. Please see what you may and may not do after receiving answers. | |
| Jul 9, 2018 at 4:47 | history | rollback | Heslacher |
Rollback to Revision 3
|
|
| Jul 9, 2018 at 4:33 | history | edited | unalignedmemoryaccess | CC BY-SA 4.0 |
added 3085 characters in body
|
| Jul 8, 2018 at 23:34 | answer | added | JDługosz | timeline score: 2 | |
| Jul 8, 2018 at 23:09 | comment | added | JDługosz | Sounds like this: boost.org/doc/libs/1_67_0/doc/html/intrusive.html | |
| Jul 8, 2018 at 22:44 | comment | added | unalignedmemoryaccess | @Deduplicator thanks. I would call this linkedlist more "static" one as it is part of class itself. For dynamic one, where node is allocated for each entry separatelly, I would use value instead of pointer. Does it seems logical? This means that one node can be part of only one linkedlist at a time, doubly linkedlist. Multi-list does not work. | |
| Jul 8, 2018 at 22:40 | comment | added | Deduplicator | BTW: Most often, a node consists of links and the payload, not a pointer to the payload. The links are the prev- and next-pointers, and also a member of the list-class. | |
| Jul 8, 2018 at 22:40 | comment | added | user1118321 | Interesting! I've never seen it in practice. I'll have to read more about it. | |
| Jul 8, 2018 at 22:38 | history | edited | 200_success |
edited tags
|
|
| Jul 8, 2018 at 22:37 | comment | added | Deduplicator | @user1118321 The CRTP is a Thing: stackoverflow.com/questions/tagged/crtp | |
| Jul 8, 2018 at 22:36 | comment | added | user1118321 | I'm unable to comment on the rest because I don't understand the declaration. Sorry! | |
| Jul 8, 2018 at 22:34 | comment | added | unalignedmemoryaccess |
@user1118321 thanks for letting me know. Trying to remove it, I have compilation errors, so seems like it should be there. The rest seems ok? With this approach I can achieve that new is only called for Widget class and not second one for LinkedListNode class.
|
|
| Jul 8, 2018 at 22:29 | comment | added | user1118321 | Yes, you need a type. By circular I meant that the type is defined in terms of the type. It must have some use, as it compiles just fine, but its meaning is far from obvious to me. | |
| Jul 8, 2018 at 22:29 | history | edited | unalignedmemoryaccess | CC BY-SA 4.0 |
edited body
|
| Jul 8, 2018 at 22:27 | comment | added | unalignedmemoryaccess | Since linkedlist node is template, I assume you need type. Am I wrong? Cirxular definition is not as linkedlist node has only pointers. | |
| Jul 8, 2018 at 22:25 | comment | added | user1118321 |
I'm surprised this compiles: class Widget: public LinkedListNode<Widget>. I don't understand what that would mean conceptually. A Widget is a linked list node of type Widget? Isn't that a circular definition?
|
|
| Jul 8, 2018 at 22:11 | review | First posts | |||
| Jul 9, 2018 at 1:13 | |||||
| Jul 8, 2018 at 22:06 | history | asked | unalignedmemoryaccess | CC BY-SA 4.0 |