Convert HasOperatorShiftLeft to a concept.
Change the implementation of `HasOperatorShiftLeft` to use a concept.
Change-Id: Ib6f58e84e101f424829c8ddf2a13270dd2ce09c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/239094
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/rtti/traits.h b/src/tint/utils/rtti/traits.h
index 00d3473..7956ab4 100644
--- a/src/tint/utils/rtti/traits.h
+++ b/src/tint/utils/rtti/traits.h
@@ -234,22 +234,10 @@
////////////////////////////////////////////////////////////////////////////////
// HasOperatorShiftLeft
////////////////////////////////////////////////////////////////////////////////
-namespace detail {
-/// Helper for determining whether the operator<<(LHS, RHS) exists
-template <typename LHS, typename RHS, typename = void>
-struct HasOperatorShiftLeft : std::false_type {};
-/// Specialization to detect operator
-template <typename LHS, typename RHS>
-struct HasOperatorShiftLeft<LHS,
- RHS,
- std::void_t<decltype(std::declval<LHS&>() << std::declval<RHS>())>>
- : std::true_type {};
-
-} // namespace detail
/// Is true if operator<<(LHS, RHS) exists
template <typename LHS, typename RHS>
-static constexpr bool HasOperatorShiftLeft = detail::HasOperatorShiftLeft<LHS, RHS>::value;
+concept HasOperatorShiftLeft = requires(LHS os, RHS a) { os << a; };
} // namespace tint::traits