2 ms·
Most STL implementations have always done this. This is one reason why it's better to use the empty() check for an empty container instead of size() == 0 for al
by berkut 13y ago
Most STL implementations have always done this. This is one reason why it's better to use the empty() check for an empty container instead of size() == 0 for all container types.
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...
- cmircea 13y agoSure, but blowing the cache just to count is nuts.