Skip to content

unordered set node undefined behavior #96

Description

@kelbon

Im trying to use vector of buckets for dynamic extension.

My code:

      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:

   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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions