From: River Riddle Date: Mon, 27 May 2019 16:05:17 +0000 (-0700) Subject: Move the 'is_detected' utility out of StorageUniquer and into STLExtras to allow... X-Git-Tag: llvmorg-11-init~1466^2~1588 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46d657a277f07233d0ee7a5522fc27d962922307;p=platform%2Fupstream%2Fllvm.git Move the 'is_detected' utility out of StorageUniquer and into STLExtras to allow reuse throughout the codebase. -- PiperOrigin-RevId: 250160508 --- diff --git a/mlir/include/mlir/Support/STLExtras.h b/mlir/include/mlir/Support/STLExtras.h index b99b09d..c9a5198 100644 --- a/mlir/include/mlir/Support/STLExtras.h +++ b/mlir/include/mlir/Support/STLExtras.h @@ -84,6 +84,27 @@ struct alignas(8) ClassID { return &id; } }; + +/// Utilities for detecting if a given trait holds for some set of arguments +/// 'Args'. For example, the given trait could be used to detect if a given type +/// has a copy assignment operator: +/// template +/// using has_copy_assign_t = decltype(std::declval() +/// = std::declval()); +/// bool fooHasCopyAssign = is_detected::value; +namespace detail { +template using void_t = void; +template class Op, class... Args> struct detector { + using value_t = std::false_type; +}; +template