Skip to content

Commit

Permalink
Update the comments on F14 tables to be accurate.
Browse files Browse the repository at this point in the history
Summary:
You can verify this behavior directly:
```
folly::F14FastSet<int> s;
for (int i = 0; i < 1000; ++i) {
  s.insert(i);
}
#define OUT(x) std::cout << #x << " -> " << (x)
OUT(s.bucket_count());
s.erase(s.begin(), s.end());
OUT(s.bucket_count());
s.clear();
OUT(s.bucket_count());
```
Output:
```
s.bucket_count() -> 1280
s.bucket_count() -> 1280
s.bucket_count() -> 0
```
Feel free to commandeer if you want to update the comment to suggest the erase idiom to avoid deallocating capacity.

Reviewed By: Gownta

Differential Revision: D52513904

fbshipit-source-id: 1cf61c7d4fade06b576b6751daac61020c4900a6
  • Loading branch information
Jeremy Fincher authored and facebook-github-bot committed Jan 14, 2024
1 parent 64fcfac commit 7e9cbfe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion folly/container/F14Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class F14BasicMap {
* Remove all elements.
* @methodset Modifiers
*
* Does not free heap-allocated memory; capacity is unchanged.
* Frees heap-allocated memory; bucket_count is returned to 0.
*/
void clear() noexcept { table_.clear(); }

Expand Down
2 changes: 1 addition & 1 deletion folly/container/F14Set.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class F14BasicSet {
/**
* Remove all elements.
*
* Does not free heap-allocated memory; capacity is unchanged.
* Frees heap-allocated memory; bucket_count is returned to 0.
*
* @methodset Modifiers
*/
Expand Down

0 comments on commit 7e9cbfe

Please sign in to comment.