Skip to content

Commit

Permalink
Document Reference invalidation on insert - Issue #45
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Nov 4, 2017
1 parent ea571c7 commit bfb0de7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ int main()

No compilation is needed, as this is a header-only library. The installation consist in copying the sparsepp directory wherever it will be convenient to include in your project(s).

## Warning - iterator invalidation on erase/insert
## Warning - iterator and reference invalidation on erase/insert

1. erasing elements is likely to invalidate iterators (for example when calling `erase()`)

2. inserting new elements is likely to invalidate iterators (iterator invalidation can also happen with std::unordered_map if rehashing occurs due to the insertion)

3. references to values stored in a sparse_hash_map or set are likely to be invalidated on insert()/erase(). This is not the case for std::unordered_map or set.

## Usage

As shown in the example above, you need to include the header file: `#include <sparsepp/spp.h>`
Expand Down

0 comments on commit bfb0de7

Please sign in to comment.