Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades the codebase to require C++20 as the minimum standard for extension builds. The change modernizes the codebase by replacing older C++17 constructs and string formatting approaches with C++20 features.
Key changes:
- Updates minimum C++ standard requirement from C++17 to C++20
- Replaces
std::ostringstreamstring formatting with C++20std::format - Modernizes template syntax using C++20
requiresclauses instead of SFINAE - Updates build configuration and CI workflows to use C++20
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Updates minimum C++ standard requirement from 17 to 20 |
| src/treespec/unflatten.cpp | Replaces ostringstream with std::format, adds std::span usage |
| src/treespec/treespec.cpp | Extensive modernization with std::format, std::span, std::ranges, and constinit |
| src/treespec/traversal.cpp | Updates string formatting to use std::format |
| src/treespec/serialization.cpp | Uses std::unordered_map::contains instead of find comparison |
| src/treespec/richcomparison.cpp | Replaces std algorithm calls with std::ranges equivalents |
| src/treespec/hashing.cpp | Uses std::unordered_map::contains for cleaner code |
| src/treespec/flatten.cpp | Comprehensive string formatting updates and template parameter renaming |
| src/treespec/constructors.cpp | String formatting modernization and std::ranges usage |
| src/registry.cpp | Updates string formatting and replaces PYBIND11_CONSTINIT with constinit |
| src/optree.cpp | String formatting updates and constinit usage |
| include/optree/treespec.h | Updates function signatures to use std::span and modernizes template parameters |
| include/optree/pytypes.h | Adds std::formatter specializations and modernizes template syntax with requires clauses |
| include/optree/pymacros.h | Replaces PYBIND11_CONSTINIT with constinit |
| include/optree/exceptions.h | Major refactoring using std::source_location and std::format for error handling |
| README.md | Updates documentation to reflect C++20 requirement |
| CPPLINT.cfg | Adds whitespace/braces filter |
| .github/workflows/tests.yml | Removes C++17 compatibility test |
| .github/workflows/lint.yml | Updates clang-tidy to use C++20 |
| .clang-format | Updates standard from c++17 to c++20 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 1416 1416
Branches 175 175
=========================================
Hits 1416 1416 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9388aa9 to
b3e5183
Compare
Member
Author
|
6887698 to
c0e6a1d
Compare
a343cd1 to
b9f2140
Compare
ce0ec4b to
5af5e9b
Compare
430d021 to
f35b9b6
Compare
74793af to
947195f
Compare
b834e96 to
4caf09f
Compare
b40c207 to
0b08991
Compare
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.
Description
Describe your changes in detail.
Motivation and Context
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
You can use the syntax
close #15213if this solves the issue #15213Types of changes
What types of changes does your code introduce? Put an
xin all the boxes that apply:Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!
make format. (required)make lint. (required)make testpass. (required)