(Conceptually, at least: capacity should really be a size_t, not an unsigned int.)