An assortment of c++ containers for various uses.
NOTE: Currently working on moving my c++ libraries to https://github.com/Andersama-Library/open-source/tree/c++.
A vector (of pointers) that maintains pointer stablility to it's underlying members.
A c++17~ in place vector type
A c++20 vector with additional public functions for the performance minded.
- unchecked_emplace_back()
- cleared_reserve()
- unchecked_reserve()
Growth api
- emplace_back_with_policy()
- push_back_with_policy()
When vector needs to grow, takes a struct defining a function which calculates a new desired capacity, Allows for control over the growth of a vector in a more precise way. For example here is a policy which always returns the necessary required capacity. The returned value must be >= than required_capacity or you should expect undefined behavior.
struct default_expansion_policy {
[[nodiscard]] constexpr size_t grow_capacity(size_t size, size_t capacity, size_t required_capacity) noexcept {
return required_capacity;
}
};