Automated Code Change

PiperOrigin-RevId: 939608120
diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
index 2238d69..c370511 100644
--- a/src/google/protobuf/parse_context.h
+++ b/src/google/protobuf/parse_context.h
@@ -670,7 +670,7 @@
 
 using LazyEagerVerifyFnType = const char* (*)(const char* ptr,
                                               ParseContext* ctx);
-using LazyEagerVerifyFnRef = std::remove_pointer<LazyEagerVerifyFnType>::type&;
+using LazyEagerVerifyFnRef = std::remove_pointer_t<LazyEagerVerifyFnType>&;
 
 // ParseContext holds all data that is global to the entire parse. Most
 // importantly it contains the input stream, but also recursion depth and also
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
index 6f00ff0..51f834e 100644
--- a/src/google/protobuf/port.h
+++ b/src/google/protobuf/port.h
@@ -198,7 +198,7 @@
 
 template <typename To, typename From>
 void AssertDownCast(From* from) {
-  static_assert(std::is_base_of<From, To>::value, "illegal DownCast");
+  static_assert(std::is_base_of_v<From, To>, "illegal DownCast");
 
   // Check that this function is not used to downcast message types.
   // For those we should use {Down,Dynamic}CastTo{Message,Generated}.
diff --git a/src/google/protobuf/reflection.h b/src/google/protobuf/reflection.h
index 024b3be..fe6e6f9 100644
--- a/src/google/protobuf/reflection.h
+++ b/src/google/protobuf/reflection.h
@@ -58,8 +58,7 @@
 
 // RepeatedFieldRef definition for non-message types.
 template <typename T>
-class RepeatedFieldRef<
-    T, typename std::enable_if<!std::is_base_of<Message, T>::value>::type> {
+class RepeatedFieldRef<T, std::enable_if_t<!std::is_base_of_v<Message, T>>> {
   typedef typename internal::RefTypeTraits<T>::iterator IteratorType;
   typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
 
@@ -106,7 +105,7 @@
 // MutableRepeatedFieldRef definition for non-message types.
 template <typename T>
 class MutableRepeatedFieldRef<
-    T, typename std::enable_if<!std::is_base_of<Message, T>::value>::type> {
+    T, std::enable_if_t<!std::is_base_of_v<Message, T>>> {
   typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
 
  public:
@@ -169,8 +168,7 @@
 
 // RepeatedFieldRef definition for message types.
 template <typename T>
-class RepeatedFieldRef<
-    T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+class RepeatedFieldRef<T, std::enable_if_t<std::is_base_of_v<Message, T>>> {
   typedef typename internal::RefTypeTraits<T>::iterator IteratorType;
   typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
 
@@ -234,8 +232,8 @@
 
 // MutableRepeatedFieldRef definition for message types.
 template <typename T>
-class MutableRepeatedFieldRef<
-    T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+class MutableRepeatedFieldRef<T,
+                              std::enable_if_t<std::is_base_of_v<Message, T>>> {
   typedef typename internal::RefTypeTraits<T>::AccessorType AccessorType;
 
  public:
@@ -551,8 +549,7 @@
 #undef DEFINE_PRIMITIVE
 
 template <typename T>
-struct RefTypeTraits<
-    T, typename std::enable_if<PrimitiveTraits<T>::is_primitive>::type> {
+struct RefTypeTraits<T, std::enable_if_t<PrimitiveTraits<T>::is_primitive>> {
   typedef RepeatedFieldRefIterator<T> iterator;
   typedef RepeatedFieldAccessor AccessorType;
   typedef T AccessorValueType;
@@ -582,8 +579,7 @@
 };
 
 template <typename T>
-struct RefTypeTraits<
-    T, typename std::enable_if<std::is_same<std::string, T>::value>::type> {
+struct RefTypeTraits<T, std::enable_if_t<std::is_same_v<std::string, T>>> {
   typedef RepeatedFieldRefIterator<T> iterator;
   typedef RepeatedFieldAccessor AccessorType;
   typedef std::string AccessorValueType;
@@ -608,8 +604,7 @@
 };
 
 template <typename T>
-struct RefTypeTraits<
-    T, typename std::enable_if<std::is_base_of<Message, T>::value>::type> {
+struct RefTypeTraits<T, std::enable_if_t<std::is_base_of_v<Message, T>>> {
   typedef RepeatedFieldRefIterator<T> iterator;
   typedef RepeatedFieldAccessor AccessorType;
   typedef Message AccessorValueType;
diff --git a/src/google/protobuf/reflection_visit_field_info.h b/src/google/protobuf/reflection_visit_field_info.h
index 21bea03..3362fc8 100644
--- a/src/google/protobuf/reflection_visit_field_info.h
+++ b/src/google/protobuf/reflection_visit_field_info.h
@@ -57,10 +57,10 @@
   // Users who need to know the "size" of a non-random-access iterator_range
   // should pass the range to `absl::c_distance()` instead.
   template <class It = IteratorT>
-  typename std::enable_if<std::is_base_of<std::random_access_iterator_tag,
-                                          typename std::iterator_traits<
-                                              It>::iterator_category>::value,
-                          size_t>::type
+  std::enable_if_t<
+      std::is_base_of_v<std::random_access_iterator_tag,
+                        typename std::iterator_traits<It>::iterator_category>,
+      size_t>
   size() const {
     return std::distance(begin_iterator_, end_iterator_);
   }
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index aa9b4ab..263f79c 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -301,21 +301,21 @@
   static_assert(
       alignof(Arena) >= alignof(Element),
       "We only support types that have an alignment smaller than Arena");
-  static_assert(!std::is_const<Element>::value,
+  static_assert(!std::is_const_v<Element>,
                 "We do not support const value types.");
-  static_assert(!std::is_volatile<Element>::value,
+  static_assert(!std::is_volatile_v<Element>,
                 "We do not support volatile value types.");
-  static_assert(!std::is_pointer<Element>::value,
+  static_assert(!std::is_pointer_v<Element>,
                 "We do not support pointer value types.");
-  static_assert(!std::is_reference<Element>::value,
+  static_assert(!std::is_reference_v<Element>,
                 "We do not support reference value types.");
   static constexpr PROTOBUF_ALWAYS_INLINE void StaticValidityCheck() {
     static_assert(
-        std::disjunction<internal::is_supported_integral_type<Element>,
-                         internal::is_supported_floating_point_type<Element>,
-                         std::is_same<absl::Cord, Element>,
-                         std::is_same<UnknownField, Element>,
-                         is_proto_enum<Element>>::value,
+        std::disjunction_v<internal::is_supported_integral_type<Element>,
+                           internal::is_supported_floating_point_type<Element>,
+                           std::is_same<absl::Cord, Element>,
+                           std::is_same<UnknownField, Element>,
+                           is_proto_enum<Element>>,
         "We only support non-string scalars in RepeatedField.");
   }
 
@@ -337,9 +337,8 @@
       : RepeatedField(internal::InternalMetadataOffset(), /*arena=*/nullptr,
                       rhs) {}
 
-  template <typename Iter,
-            typename = typename std::enable_if<std::is_constructible<
-                Element, decltype(*std::declval<Iter>())>::value>::type>
+  template <typename Iter, typename = std::enable_if_t<std::is_constructible_v<
+                               Element, decltype(*std::declval<Iter>())>>>
   RepeatedField(Iter begin, Iter end);
 
   // Arena enabled constructors: for internal use only.
@@ -649,7 +648,7 @@
   // This function does nothing if `Element` is trivial.
   static void Destroy([[maybe_unused]] const Element* begin,
                       [[maybe_unused]] const Element* end) {
-    if constexpr (!std::is_trivially_destructible<Element>::value) {
+    if constexpr (!std::is_trivially_destructible_v<Element>) {
       std::for_each(begin, end, [&](const Element& e) { e.~Element(); });
     }
   }
@@ -1192,9 +1191,9 @@
 template <typename ArenaProvider, typename Iter>
 inline void RepeatedField<Element>::AddWithArena(ArenaProvider arena_provider,
                                                  Iter begin, Iter end) {
-  if (std::is_base_of<
+  if (std::is_base_of_v<
           std::forward_iterator_tag,
-          typename std::iterator_traits<Iter>::iterator_category>::value) {
+          typename std::iterator_traits<Iter>::iterator_category>) {
     AddForwardIterator(arena_provider, begin, end);
   } else {
     AddInputIterator(arena_provider, begin, end);
@@ -1589,7 +1588,7 @@
   if (old_size > 0) {
     Element* pnew = new_rep->elements<Element>();
     Element* pold = elements(was_soo);
-    if constexpr (std::is_trivially_copyable<Element>::value ||
+    if constexpr (std::is_trivially_copyable_v<Element> ||
                   absl::is_trivially_relocatable<Element>::value) {
       memcpy(static_cast<void*>(pnew), pold, old_size * sizeof(Element));
     } else {
@@ -1657,8 +1656,7 @@
 template <typename Element>
 class RepeatedIterator {
  private:
-  using traits =
-      std::iterator_traits<typename std::remove_const<Element>::type*>;
+  using traits = std::iterator_traits<std::remove_const_t<Element>*>;
 
  public:
   // Note: value_type is never cv-qualified.