diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 9449869367c..84b2a3eb402 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -436,14 +436,10 @@ inline namespace fundamentals_v1
 
   // [string.view.comparison], non-member basic_string_view comparison functions
 
-  namespace __detail
-  {
-    // Identity transform to create a non-deduced context, so that only one
-    // argument participates in template argument deduction and the other
-    // argument gets implicitly converted to the deduced type. See n3766.html.
-    template<typename _Tp>
-      using __idt = common_type_t<_Tp>;
-  }
+  // Several of these functions use type_identity_t to create a non-deduced
+  // context, so that only one argument participates in template argument
+  // deduction and the other argument gets implicitly converted to the deduced
+  // type (see N3766).
 
   template<typename _CharT, typename _Traits>
     constexpr bool
@@ -454,12 +450,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
@@ -472,12 +469,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
@@ -490,12 +488,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
@@ -508,12 +507,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
@@ -526,12 +526,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
@@ -544,12 +545,13 @@ inline namespace fundamentals_v1
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 42822cc41ab..e8b6ed3af12 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -459,14 +459,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // [string.view.comparison], non-member basic_string_view comparison function
 
-  namespace __detail
-  {
-    // Identity transform to create a non-deduced context, so that only one
-    // argument participates in template argument deduction and the other
-    // argument gets implicitly converted to the deduced type. See n3766.html.
-    template<typename _Tp>
-      using __idt = common_type_t<_Tp>;
-  }
+  // Several of these functions use type_identity_t to create a non-deduced
+  // context, so that only one argument participates in template argument
+  // deduction and the other argument gets implicitly converted to the deduced
+  // type (see N3766).
 
   template<typename _CharT, typename _Traits>
     constexpr bool
@@ -477,12 +473,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
@@ -495,12 +492,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
@@ -513,12 +511,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
@@ -531,12 +530,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
@@ -549,12 +549,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
@@ -567,12 +568,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _CharT, typename _Traits>
     constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
-               __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
     constexpr bool
-    operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+    operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index b07291706ac..d8ed1ce120d 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -92,9 +92,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct conditional;
 
   template <typename _Type>
-    struct __type_identity {
-      using type = _Type;
-    };
+    struct __type_identity
+    { using type = _Type; };
+
+  template<typename _Tp>
+    using __type_identity_t = typename __type_identity<_Tp>::type;
 
   template<typename...>
     struct __or_;
