Skip to content

Modernize to C++17: replace deprecated aligned_storage, add nodiscard#170

Open
HFTrader wants to merge 1 commit intoefficient:masterfrom
HFTrader:modernize-cpp17
Open

Modernize to C++17: replace deprecated aligned_storage, add nodiscard#170
HFTrader wants to merge 1 commit intoefficient:masterfrom
HFTrader:modernize-cpp17

Conversation

@HFTrader
Copy link
Copy Markdown

Summary

Bump minimum standard from C++11 to C++17 and apply modernizations:

  • Replace std::aligned_storage (deprecated C++23, removed C++26) with alignas + std::byte arrays in bucket_container. Use std::launder for pointer access to constructed objects, and a separate storage_ptr() for construct/destroy on uninitialized storage
  • Add [[nodiscard]] to public query functions: hash_function(), key_eq(), get_allocator(), hashpower(), bucket_count(), empty(), size(), capacity(), load_factor(), contains()
  • Mark primary constructor explicit to prevent implicit conversion from size_type
  • Update CMake target_compile_features from cxx_constexpr to cxx_std_17

Test plan

  • All existing unit tests pass
  • Universal benchmark builds and runs
  • Verified with GCC 13.3

Bump minimum standard from C++11 to C++17 and apply modernizations:

- Replace deprecated std::aligned_storage (removed in C++26) with
  alignas + std::byte arrays in bucket_container. Use std::launder
  for pointer access to constructed objects, and a separate
  storage_ptr() for construct/destroy on uninitialized storage.

- Add [[nodiscard]] to public query functions: hash_function(),
  key_eq(), get_allocator(), hashpower(), bucket_count(), empty(),
  size(), capacity(), load_factor(), contains().

- Mark primary constructor explicit to prevent implicit conversion
  from size_type.

- Update CMake target_compile_features from cxx_constexpr to
  cxx_std_17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant