I’m not a fan, personally. a status quo solution is to instead always reserve by calling ensureUnusedCapacityPrecise. you lose out on the allocation-time-amortization benefits of superlinear allocation growth this way, but you also trip the assertion that you want.
why not? you can have superlinear growth + assertions using the proposed api.
Well, making every container bigger to accomodate the reserved field seems like a significant downside
that field would only occupy space in debug builds
Maybe “precise” should be the default in debug build ? That way everone is happy?
1 Like