Suppose we have two different doubly-linked list structures:
One has content of the node embedded directly in the node:
struct Content {
// some stuff
};
struct Node {
struct Node *next;
struct Node *prev;
struct Content content;
}The other has a pointer to content:
struct Content;
struct Node {
struct Node *next;
struct Node *prev;
struct Content *content;
}
What are considerations to prefer one option to the other? The points can be about everything: performance in different conditions, architecture, ease of modification, ease of manipulating the list, etc.
I'd like to gather knowledge about the trade-offs present.
Shown code is C, but the question also applies to C++, or any other language which has explicit pointers.
Aucun commentaire:
Enregistrer un commentaire