Skip to content

Should vec::reserve reserve the exact amount or in powers of two? #2071

Closed

Description

@brson

Currently it's exact, but there are places in vec that use it in conjuction with next_power_of_two to do it the other way, and #2062 also wants to reserve in powers of two.

Clearly there should be two different versions. Should the default be exact? If so, what should the next_power_of_two version be called?

Activity

  1. brson commented on Mar 29, 2012

    @brson
    ContributorAuthor

    Jesse suggested reserve_at_least which I think is good. Think I will go ahead and add that and update the documentation on vec::reserve to indicate the exact behavior. Do the same for str::reserve probably.

  2. ghost assigned on Mar 29, 2012
  3. brson commented on Mar 29, 2012

    @brson
    ContributorAuthor

    Implemented.

  4. added a commit that references this issue on Apr 16, 2026
  5. added 2 commits that reference this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions