| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@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) |
Sorry, something went wrong.
|
This is a good pull. However, the current doxygen is not able to recognize the keyword require and thus cannot generate docs correctly. Will delay this off until doxygen is capable of doing it. |
Sorry, something went wrong.
|
Since all of the places using requires are guarded by #if __cplusplus >= TF_CPP20 you could extend these guards to #if __cplusplus >= TF_CPP20 && !DOXYGEN to make sure that doxygen never sees the requires clauses, even though the compiler does. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This pull request updates the code to use C++20's requires keyword in place of SFINAE-based constraints. This change brings several benefits:
Improved Readability: requires offers a cleaner and more intuitive way to express template constraints. In contrast, SFINAE requires constraints to be embedded within the template parameter list using enable_if_t and a special nullptr. By separating the constraints from the template parameters, requires improves code clarity and makes the intention of the template easier to understand.
Enhanced Type Safety: Using requires allows 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.