Use 'requires' keyword to support C++20 features#666
Open
yumeno-yan wants to merge 1 commit intotaskflow:masterfrom
Open
Use 'requires' keyword to support C++20 features#666yumeno-yan wants to merge 1 commit intotaskflow:masterfrom
yumeno-yan wants to merge 1 commit intotaskflow:masterfrom
Conversation
Member
|
@yumeno-yan thank you for this pull request - and sorry for the delay. This is an amazing change as it simplifies a lot of meta programming. However, I will keep this open now as doing this will confuse the doxygen when generating correct template tags. We plan to migrate everything to C++20 in the near future (v4.0) |
Member
|
This is a good pull. However, the current doxygen is not able to recognize the keyword |
Contributor
|
Since all of the places using you could extend these guards to to make sure that doxygen never sees the |
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.
This pull request updates the code to use C++20's
requireskeyword in place of SFINAE-based constraints. This change brings several benefits:Improved Readability:
requiresoffers a cleaner and more intuitive way to express template constraints. In contrast, SFINAE requires constraints to be embedded within the template parameter list usingenable_if_tand a specialnullptr. By separating the constraints from the template parameters,requiresimproves code clarity and makes the intention of the template easier to understand.Enhanced Type Safety: Using
requiresallows the compiler to more easily validate template parameters against the specified conditions, providing better type-checking and more precise error messages during compilation. When a constraint fails, the compiler can now show exactly which concept check failed, making it easier to pinpoint and fix issues. This helps catch potential errors early, reducing the likelihood of subtle bugs that might arise from more complex SFINAE conditions.Aligning with C++20 Standards: By using
requires, the code is more in line with modern C++ standards. This approach embraces C++20 features, ensuring that the code remains up-to-date and takes advantage of the latest language improvements.