It's four goddamn bytes. Or eight if you really want more than 4 billion elements.
It's four goddamn bytes. Or eight if you really want more than 4 billion elements.
Also, linked lists are notoriously crap for cache coherency / processor pre-fetching and branch prediction by processors anyway, given that there's no guarantee where each node will be allocated - the only way to do that is pull them off a slab allocator or something, in which case you might as well use a vector or deque anyway...
As long as you don't have millions of lists with a few elements each -- you can't presume that they are only used one way :)
That may make 'splice' slower. See http://home.roadrunner.com/~hinnant/On_list_size.html (I think that could be solved by having list iterators carry a field pointing to their container, but haven't given it much thought. Corrections welcome)
Storing an index in the iterator would not be a solution either. That would mean updating the index in all the existing iterators when you insert an object in the list.
libc++ has the luxury of assuming c++11.
Hell, you probably lose that much to padding somewhere anyways.