[all-commits] [llvm/llvm-project] 622605: [ADT] Add C++20-style llvm::identity_cxx20 (#164143)
Kazu Hirata via All-commits
all-commits at lists.llvm.org
Sun Oct 19 08:34:20 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 622605e69482862914febfaeaf036aae011e0786
https://github.com/llvm/llvm-project/commit/622605e69482862914febfaeaf036aae011e0786
Author: Kazu Hirata <kazu at google.com>
Date: 2025-10-19 (Sun, 19 Oct 2025)
Changed paths:
M llvm/include/llvm/ADT/STLForwardCompat.h
M llvm/unittests/ADT/STLForwardCompatTest.cpp
Log Message:
-----------
[ADT] Add C++20-style llvm::identity_cxx20 (#164143)
Currently, our llvm::identity<T> is not quite like std::identity from
C++20. Ours is a template struct while std::identity is a
non-template struct with templatized operator(). This difference
means that we cannot mechanically replace llvm::identity with
std::identity when we switch to C++20 in the future.
This patch implements llvm::identity_cxx20, which behaves exactly like
std::identity.
Once this patch lands, I'm planning to migrate users of llvm::identity
to the new style. There aren't that many:
- 4 instances of SparseSet<...>
- 3 instances of SparseMultiSet<...>
- about 50 instances of IndexedMap<...>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list