Commit Graph

1 Commits (master)

Author SHA1 Message Date
Andreas Molzer 35864e38fa Add a slot map implementation
A slot map is a linear container similar to a vector but the indices
contain are invalidated when the element is removed, and can not (or are
very unlikely to) incidentally refer to a valid element again even if
new elements are inserted.

This implementation differs from allocating slot maps as it does not
prefer value semantics for inserting and removing elements but rather
offers a reserve and remove interface based on mutable references. This
makes it easier for a user to avoid dropping any instances as any
initialization and de-initialization can be freely chosen to write or
swap. This is important if instances may contain costly resources such
as allocations that are hard to recover.
2020-01-25 09:54:07 +00:00