diff options
author | Vincent Ambo <mail@tazj.in> | 2020-11-21T13·43+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-11-21T14·48+0100 |
commit | 082c006c04343a78d87b6c6ab3608c25d6213c3f (patch) | |
tree | 16e6f04f8d1d1d2d67e8e917d5e7bb48c1b60375 /third_party/abseil_cpp/absl/meta | |
parent | cc27324d0226953943f408ce3c69ad7d648e005e (diff) |
merge(3p/absl): subtree merge of Abseil up to e19260f r/1889
... notably, this includes Abseil's own StatusOr type, which conflicted with our implementation (that was taken from TensorFlow). Change-Id: Ie7d6764b64055caaeb8dc7b6b9d066291e6b538f
Diffstat (limited to 'third_party/abseil_cpp/absl/meta')
-rw-r--r-- | third_party/abseil_cpp/absl/meta/BUILD.bazel | 2 | ||||
-rw-r--r-- | third_party/abseil_cpp/absl/meta/type_traits.h | 28 |
2 files changed, 19 insertions, 11 deletions
diff --git a/third_party/abseil_cpp/absl/meta/BUILD.bazel b/third_party/abseil_cpp/absl/meta/BUILD.bazel index c06d2d9708c1..5585fcca794a 100644 --- a/third_party/abseil_cpp/absl/meta/BUILD.bazel +++ b/third_party/abseil_cpp/absl/meta/BUILD.bazel @@ -24,7 +24,7 @@ load( package(default_visibility = ["//visibility:public"]) -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) cc_library( name = "type_traits", diff --git a/third_party/abseil_cpp/absl/meta/type_traits.h b/third_party/abseil_cpp/absl/meta/type_traits.h index ba87d2f0edfa..d5cb5f3be39d 100644 --- a/third_party/abseil_cpp/absl/meta/type_traits.h +++ b/third_party/abseil_cpp/absl/meta/type_traits.h @@ -219,7 +219,7 @@ using void_t = typename type_traits_internal::VoidTImpl<Ts...>::type; // This metafunction is designed to be a drop-in replacement for the C++17 // `std::conjunction` metafunction. template <typename... Ts> -struct conjunction; +struct conjunction : std::true_type {}; template <typename T, typename... Ts> struct conjunction<T, Ts...> @@ -228,9 +228,6 @@ struct conjunction<T, Ts...> template <typename T> struct conjunction<T> : T {}; -template <> -struct conjunction<> : std::true_type {}; - // disjunction // // Performs a compile-time logical OR operation on the passed types (which @@ -241,7 +238,7 @@ struct conjunction<> : std::true_type {}; // This metafunction is designed to be a drop-in replacement for the C++17 // `std::disjunction` metafunction. template <typename... Ts> -struct disjunction; +struct disjunction : std::false_type {}; template <typename T, typename... Ts> struct disjunction<T, Ts...> : @@ -250,9 +247,6 @@ struct disjunction<T, Ts...> : template <typename T> struct disjunction<T> : T {}; -template <> -struct disjunction<> : std::false_type {}; - // negation // // Performs a compile-time logical NOT operation on the passed type (which @@ -616,8 +610,22 @@ using common_type_t = typename std::common_type<T...>::type; template <typename T> using underlying_type_t = typename std::underlying_type<T>::type; -template <typename T> -using result_of_t = typename std::result_of<T>::type; + +namespace type_traits_internal { + +#if __cplusplus >= 201703L +// std::result_of is deprecated (C++17) or removed (C++20) +template<typename> struct result_of; +template<typename F, typename... Args> +struct result_of<F(Args...)> : std::invoke_result<F, Args...> {}; +#else +template<typename F> using result_of = std::result_of<F>; +#endif + +} // namespace type_traits_internal + +template<typename F> +using result_of_t = typename type_traits_internal::result_of<F>::type; namespace type_traits_internal { // In MSVC we can't probe std::hash or stdext::hash because it triggers a |