Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR abseil#1830: C++17 improvement: use if constexpr in internal/hash.h
Imported from GitHub PR abseil#1830 As the minimal supported C++ version of Abseil is now C++17, it has become possible to use if constexpr statements. Apply usage of if constexpr in the header file hash.h. Benefits of using if constexpr are: - Improved readability: explicit that the expression will be evaluated at compile time. - Required code is generated during compile phase instead of selected in optimizer phase. Improved guarantee that if statement is not checked at runtime. - Prevents MSVC warning C4127: conditional expression is constant (when this warning is explicitly enabled when building Abseil with MSVC). Remark: there are other header files that could be updated for if constexpr. This PR only addresses hash.h as recommended by the contributing guidelines to keep PRs small. Thank you for your contribution to Abseil! Before submitting this PR, please be sure to read our [contributing guidelines](https://github.com/abseil/abseil-cpp/blob/master/CONTRIBUTING.md). If you are a Googler, please also note that it is required that you send us a Piper CL instead of using the GitHub pull-request process. The code propagation process will deliver the change to GitHub. Merge a41f765 into dc1ec89 Merging this change closes abseil#1830 COPYBARA_INTEGRATE_REVIEW=abseil#1830 from vbaderks:constexpr-hash-internal a41f765 PiperOrigin-RevId: 729188454 Change-Id: I124f5f352bc6caf9dd58dd6075404783172c9941
- Loading branch information