-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get precise with singleton checking.
- Add `is_singleton`, and change the test in `set_len` to use it, because it's more precise than testing for zero capacity. (Precise in the sense of protecting against the bad case of writing to static memory.) - Remove several "Don't mutate the empty singleton!" checks before `set_len` calls, now that `set_len` is able to handle that itself. - Add a private `set_len_non_singleton`, and use it in places where we know we're not dealing with the singleton (e.g. after calling `reserve(1)`), for ultra-efficiency.
- Loading branch information
1 parent
b6b42f3
commit d48e1ee
Showing
1 changed file
with
36 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters