Skip to content

Commit 03d26db

Browse files
[ADT] Document C++20 migration path for llvm::is_detected (llvm#164363)
The C++20 standard has adopted concepts and requires clauses as a superior alternative to std::is_detected. This patch adds a comment for llvm::is_detected to document this relationship. The utility is kept in STLForwardCompat.h to serve as a marker to migrate usages of llvm::is_detected to concepts and requires clauses when the codebase adopts C++20.
1 parent 4098e26 commit 03d26db

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/include/llvm/ADT/STLForwardCompat.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ struct detector<std::void_t<Op<Args...>>, Op, Args...> {
115115
/// using has_copy_assign_t = decltype(std::declval<T&>()
116116
/// = std::declval<const T&>());
117117
/// bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;
118+
///
119+
/// NOTE: The C++20 standard has adopted concepts and requires clauses as a
120+
/// superior alternative to std::is_detected.
121+
///
122+
/// This utility is placed in STLForwardCompat.h as a reminder
123+
/// to migrate usages of llvm::is_detected to concepts and 'requires'
124+
/// clauses when the codebase adopts C++20.
118125
template <template <class...> class Op, class... Args>
119126
using is_detected = typename detail::detector<void, Op, Args...>::value_t;
120127

0 commit comments

Comments
 (0)