Commit 9a61b00d by Lawrence Wolf-Sonkin Committed by Copybara-Service

[absl] Re-use the existing `std::type_identity` backfill instead of redefining it again

* Specifically, using `absl::internal::type_identity_t` instead of a reimplementation thereof (`NoTypeDeduction`) in the `absl::InlinedVector` code

PiperOrigin-RevId: 626055714
Change-Id: I3f5a9a1c25480bc4431edbcc4784e6bc8d257f8d
parent 6645f314
...@@ -126,6 +126,7 @@ cc_library( ...@@ -126,6 +126,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS, linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [ deps = [
":compressed_tuple", ":compressed_tuple",
"//absl/base:base_internal",
"//absl/base:config", "//absl/base:config",
"//absl/base:core_headers", "//absl/base:core_headers",
"//absl/memory", "//absl/memory",
......
...@@ -176,6 +176,7 @@ absl_cc_library( ...@@ -176,6 +176,7 @@ absl_cc_library(
COPTS COPTS
${ABSL_DEFAULT_COPTS} ${ABSL_DEFAULT_COPTS}
DEPS DEPS
absl::base_internal
absl::compressed_tuple absl::compressed_tuple
absl::config absl::config
absl::core_headers absl::core_headers
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "absl/base/attributes.h" #include "absl/base/attributes.h"
#include "absl/base/config.h" #include "absl/base/config.h"
#include "absl/base/internal/identity.h"
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/container/internal/compressed_tuple.h" #include "absl/container/internal/compressed_tuple.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
...@@ -82,16 +83,6 @@ using IsMoveAssignOk = std::is_move_assignable<ValueType<A>>; ...@@ -82,16 +83,6 @@ using IsMoveAssignOk = std::is_move_assignable<ValueType<A>>;
template <typename A> template <typename A>
using IsSwapOk = absl::type_traits_internal::IsSwappable<ValueType<A>>; using IsSwapOk = absl::type_traits_internal::IsSwappable<ValueType<A>>;
template <typename T>
struct TypeIdentity {
using type = T;
};
// Used for function arguments in template functions to prevent ADL by forcing
// callers to explicitly specify the template parameter.
template <typename T>
using NoTypeDeduction = typename TypeIdentity<T>::type;
template <typename A, bool IsTriviallyDestructible = template <typename A, bool IsTriviallyDestructible =
absl::is_trivially_destructible<ValueType<A>>::value> absl::is_trivially_destructible<ValueType<A>>::value>
struct DestroyAdapter; struct DestroyAdapter;
...@@ -139,7 +130,7 @@ struct MallocAdapter { ...@@ -139,7 +130,7 @@ struct MallocAdapter {
}; };
template <typename A, typename ValueAdapter> template <typename A, typename ValueAdapter>
void ConstructElements(NoTypeDeduction<A>& allocator, void ConstructElements(absl::internal::type_identity_t<A>& allocator,
Pointer<A> construct_first, ValueAdapter& values, Pointer<A> construct_first, ValueAdapter& values,
SizeType<A> construct_size) { SizeType<A> construct_size) {
for (SizeType<A> i = 0; i < construct_size; ++i) { for (SizeType<A> i = 0; i < construct_size; ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment