Query regarding libstdc++ std::list internal end() representation
Soul Studios
matt@soulstudios.co.nz
Wed Mar 1 00:06:00 GMT 2017
Hi there-
in order for --end() to function correctly, end() must point to an
actual node.
Two questions:
1. I couldn't find the definition for list nodes when searching through
the headers, does libstdc++ use nodes of the form:
struct node
{
T *element;
node *prev, *next;
}
or
struct node
{
T element;
node *prev, *next;
}
?
2. If the second is true, how does the end iterator avoid the allocation
of an unused element?
Thanks-
Mat
More information about the Libstdc++
mailing list