Migrate to C++20 for fbitset compatibility#5
Merged
chenpeizhi merged 5 commits intomasterfrom Nov 10, 2025
Merged
Conversation
Co-authored-by: chenpeizhi <8114085+chenpeizhi@users.noreply.github.com>
Co-authored-by: chenpeizhi <8114085+chenpeizhi@users.noreply.github.com>
Co-authored-by: chenpeizhi <8114085+chenpeizhi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update libparenth for C++20 compatibility with fbitset
Migrate to C++20 for fbitset compatibility
Nov 10, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR migrates libparenth to C++20 to maintain compatibility with the updated fbitset dependency, which now uses std::bit library functions instead of GCC builtins.
Key Changes:
- Updated build configuration to C++20 standard with CMake 3.15+ requirement
- Updated fbitset submodule to C++20-compatible version (commit 765b2f7)
- Added
[[nodiscard]]attributes to query functions for better code safety
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| CMakeLists.txt | Updated CMake minimum version to 3.15, set C++20 standard, and enforced standard requirement |
| .clang-format | Updated standard specification from Cpp11 to c++20 |
| include/libparenth.hpp | Added [[nodiscard]] attributes to API functions and documented unsigned overflow behavior in find_last() usage |
| deps/fbitset | Updated submodule to C++20-compatible version (765b2f7) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fbitset dependency migrated to C++20, replacing GCC builtins with
std::bitlibrary functions (std::countl_zero,std::countr_zero,std::popcount). This updates libparenth accordingly.Changes
CMAKE_CXX_STANDARD_REQUIRED ON[[nodiscard]]to API functions (opt(),n_dims(),n_factors(),get_tot())find_last()behavior with unsigned overflow semanticsCompatibility Note
The updated fbitset
find_last()returnsSIZE_MAX(not-1) when no bits are set. Existing code handles this correctly via well-defined unsigned wrap-around:No algorithmic changes required. All tests pass.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.