This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Query regarding libstdc++ std::list internal end() representation
- From: Soul Studios <matt at soulstudios dot co dot nz>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 01 Mar 2017 13:06:28 +1300
- Subject: Query regarding libstdc++ std::list internal end() representation
- Authentication-results: sourceware.org; auth=none
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