http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46572
Summary: forward_list nodes are not packed
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
I was playing around with forward_list and realized that all the list nodes
took up a minimum of 16 bytes (with larger sizes in multiples of 8--I am using
a 64-bit machine). This conflicts with what the standard notes in 23.3.3
paragraph 1:
Note: It is intended that forward_list have zero space or time overhead
relative to a hand-written C-style singly linked list.
If I was implementing a memory space critical linked list I would decorate the
list node struct with packed. This is not possible to do with the internal list
node.
I will upload an example program shortly.