3 ms·
I think you've got two sensible options in this case: commit, or do nothing. The standard's wording accommodates both: it's valid for a reserve to be a no-op, a
by tom_ 5y ago
I think you've got two sensible options in this case: commit, or do nothing. The standard's wording accommodates both: it's valid for a reserve to be a no-op, a situation the caller can detect (if they want to - assuming they even imagined anybody would ever do this! - I certainly never did, until now) by checking the new capacity.
It's not obvious to me that it buys you much to reserve without committing. You're taking the hint, then ignoring it. Why bother? Why not just do nothing?r