boostorg / boostorg/intrusive

unordered set node undefined behavior

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
66
Forks
74
Avg merge
5h 22m
Merged PRs (30d)
1

Description

Im trying to use vector of buckets for dynamic extension.

My code:

```cpp
buckets.resize(buckets.size() * 2);
myset.rehash({buckets.data(), buckets.size()});
```

Code compiles, but it is undefined behavior and ... Thats why:

detail/hashtable_node.hpp:

```cpp
inline bucket_impl()
{}

inline bucket_impl(const bucket_impl &)
{}

inline ~bucket_impl()
{}
```

Copy constructor(its move ctor too) does nothing and its even not noexcept, so vector .resize creates invalid nodes, then .rehash works with invalid memory = segfault

..Why? And how to do it correctly?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.