[libcxx-commits] [libcxx] [libc++][chrono] P2592R3: Hashing for chrono (PR #165132)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 27 08:34:10 PDT 2025
================
@@ -92,6 +93,17 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) no
} // namespace chrono
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::day> {
+ _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept {
+ return hash<unsigned>{}(static_cast<unsigned>(__d));
----------------
philnik777 wrote:
I wonder whether it's worth going though `hash<unsigned>`. It's just the identity anyways.
https://github.com/llvm/llvm-project/pull/165132
More information about the libcxx-commits
mailing list