Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
KredeGC committed Dec 1, 2022
1 parent 19c57ed commit f9aa86c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ This library also contains various containers that are STL compliant.
| binary_heap<br/>\<T, Comp, Alloc\> | A binary heap, sorted using the `Comp` and allocated using the given `Alloc` allocator. | `Comp` can be either `std::greater<T>` or `std::less<T>` or some other custom implementation.<br/>A shorthand version of both a min and a max heap can be used, via the `binary_min_heap<T, Alloc>` and `binary_max_heap<T, Alloc>` types. |
| trivial_array<br/>\<T, Alloc\> | An array wrapper class, similar to `std::array`, but uses dynamic allocation and is optimized for trivial types. Takes a type `T` and an allocator `Alloc`. | The container uses a straight `memcpy` for most of its operations.<br/>It's not recommended to use this with non-trivial types, eg. types that have custom default, copy or move constructors or custom destructors. |
| trivial_vector<br/>\<T, Alloc\> | A vector class, similar to `std::vector`, but optimized for trivial types. Takes a type `T` and an allocator `Alloc`. | The container uses a straight `memcpy` for most of its operations.<br/>It's not recommended to use this with non-trivial types, eg. types that have custom default, copy or move constructors or custom destructors. |
| unordered_probe_map<br/><K, V, Hash, EqualTo, Alloc> | An unordered map class similar to `std::unordered_map`, but optimized for cache locality. | Uses open addressing with linear probing for maximum cache locality.<br/>The container uses a `Hash` struct, `EqualTo` struct and `Alloc` class passed in as template parameters. |

## binary_heap interface
| Method | Description |
Expand Down
6 changes: 3 additions & 3 deletions include/ktl/containers/unordered_probe_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace ktl

V& operator[](const K& index) noexcept
{
expand(1);
expand();

pair* block = get_pair(index, m_Begin, m_Mask);

Expand Down Expand Up @@ -269,7 +269,7 @@ namespace ktl
template<typename Key, typename Value>
iterator insert(Key&& index, Value&& value) noexcept
{
expand(1);
expand();

// Disallow inserting the same key twice
// Lookup is more expensive, so only call in debug
Expand Down Expand Up @@ -359,7 +359,7 @@ namespace ktl
}
}

void expand(size_t n)
void expand()
{
if (m_Count >= capacity() / 2)
{
Expand Down

0 comments on commit f9aa86c

Please sign in to comment.