Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderedDictionary updateValue autoclosure for insertion index #312

Open
andrews05 opened this issue Aug 29, 2023 · 0 comments
Open

OrderedDictionary updateValue autoclosure for insertion index #312

andrews05 opened this issue Aug 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@andrews05
Copy link

I'm using the following OrderedDictionary function:

  public mutating func updateValue<R>(
    forKey key: Key,
    insertingDefault defaultValue: @autoclosure () -> Value,
    at index: Int,
    with body: (inout Value) throws -> R
  )

The defaultValue is an autoclosure, which is great, but it would be helpful if the index was also an autoclosure to prevent a possibly expensive index calculation if the key already exists.

@andrews05 andrews05 added the enhancement New feature or request label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant