about summary refs log tree commit diff
path: root/absl/memory/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/memory/memory.h')
-rw-r--r--absl/memory/memory.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/absl/memory/memory.h b/absl/memory/memory.h
index 22d44b9e46fe..2220ee4e412f 100644
--- a/absl/memory/memory.h
+++ b/absl/memory/memory.h
@@ -319,13 +319,23 @@ struct RebindPtr<T, U, void_t<typename T::template rebind<U>>> {
   using type = typename T::template rebind<U>;
 };
 
-template <typename T, typename U, typename = void>
+template <typename T, typename U>
+constexpr bool HasRebindAlloc(...) {
+  return false;
+}
+
+template <typename T, typename U>
+constexpr bool HasRebindAlloc(typename T::template rebind<U>::other*) {
+  return true;
+}
+
+template <typename T, typename U, bool = HasRebindAlloc<T, U>(nullptr)>
 struct RebindAlloc {
   using type = typename RebindFirstArg<T, U>::type;
 };
 
 template <typename T, typename U>
-struct RebindAlloc<T, U, void_t<typename T::template rebind<U>::other>> {
+struct RebindAlloc<T, U, true> {
   using type = typename T::template rebind<U>::other;
 };