]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer std::remove_*_t over std::remove_*::type. 15783/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 23 Jul 2023 02:44:32 +0000 (20:44 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sun, 23 Jul 2023 23:56:04 +0000 (17:56 -0600)
17 files changed:
include/deal.II/base/array_view.h
include/deal.II/base/mutable_bind.h
include/deal.II/matrix_free/evaluation_kernels.h
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/type_traits.h
include/deal.II/sundials/n_vector.templates.h
tests/base/array_view_08.cc
tests/base/array_view_09.cc
tests/fe/fe_values_view_get_function_from_local_dof_values_01.cc
tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc
tests/feinterface/fe_interface_view_get_function_from_local_dof_values_01.cc
tests/feinterface/fe_interface_view_get_function_from_local_dof_values_02.cc
tests/matrix_free/poisson_dg_hp.cc
tests/simplex/matrix_free_01.cc
tests/simplex/matrix_free_02.cc
tests/simplex/matrix_free_03.cc
tests/simplex/matrix_free_04.cc

index 6728fefeec0515b42aff6d8f4ed14c4662157f8a..f5fd75dc0e90e4bac348a603080af79cf47ed740 100644 (file)
@@ -136,8 +136,8 @@ public:
    * non-@p const view to a @p const view, akin to converting a non-@p const
    * pointer to a @p const pointer.
    */
-  ArrayView(const ArrayView<typename std::remove_cv<value_type>::type,
-                            MemorySpaceType> &view);
+  ArrayView(
+    const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType> &view);
 
   /**
    * A constructor that automatically creates a view from a single value_type
@@ -159,8 +159,7 @@ public:
    *   You cannot initialize ArrayView objects to non-@p const memory with
    *   such arguments, such as <code>ArrayView@<double@></code>.
    */
-  ArrayView(
-    const std::vector<typename std::remove_cv<value_type>::type> &vector);
+  ArrayView(const std::vector<std::remove_cv_t<value_type>> &vector);
 
   /**
    * A constructor that automatically creates a view from a std::vector object.
@@ -176,7 +175,7 @@ public:
    *   <code>ArrayView@<const double@></code>, or to non-@p const memory,
    *   such as <code>ArrayView@<double@></code>.
    */
-  ArrayView(std::vector<typename std::remove_cv<value_type>::type> &vector);
+  ArrayView(std::vector<std::remove_cv_t<value_type>> &vector);
 
   /**
    * A constructor that automatically creates a view for a given C-style array.
@@ -204,8 +203,7 @@ public:
    * a std::array.
    */
   template <std::size_t N>
-  ArrayView(
-    const std::array<typename std::remove_cv<value_type>::type, N> &vector);
+  ArrayView(const std::array<std::remove_cv_t<value_type>, N> &vector);
 
   /**
    * A constructor that automatically creates a view from a std::array object.
@@ -216,7 +214,7 @@ public:
    * a std::array.
    */
   template <std::size_t N>
-  ArrayView(std::array<typename std::remove_cv<value_type>::type, N> &vector);
+  ArrayView(std::array<std::remove_cv_t<value_type>, N> &vector);
 
   /**
    * Reinitialize a view.
@@ -271,8 +269,8 @@ public:
    * This version always compares with the non-const value_type.
    */
   bool
-  operator==(const ArrayView<typename std::remove_cv<value_type>::type,
-                             MemorySpaceType> &other_view) const;
+  operator==(const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType>
+               &other_view) const;
 
   /**
    * Compare two ArrayView objects of the same type. Two objects are considered
@@ -308,8 +306,8 @@ public:
    * This version always compares with the non-const value_type.
    */
   bool
-  operator!=(const ArrayView<typename std::remove_cv<value_type>::type,
-                             MemorySpaceType> &other_view) const;
+  operator!=(const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType>
+               &other_view) const;
 
   /**
    * Return the size (in elements) of the view of memory this object
@@ -429,8 +427,7 @@ inline ArrayView<ElementType, MemorySpaceType>::ArrayView(ElementType &element)
 
 template <typename ElementType, typename MemorySpaceType>
 inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
-  const ArrayView<typename std::remove_cv<value_type>::type, MemorySpaceType>
-    &view)
+  const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType> &view)
   : starting_element(view.starting_element)
   , n_elements(view.n_elements)
 {}
@@ -439,7 +436,7 @@ inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
 
 template <typename ElementType, typename MemorySpaceType>
 inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
-  const std::vector<typename std::remove_cv<value_type>::type> &vector)
+  const std::vector<std::remove_cv_t<value_type>> &vector)
   : // use delegating constructor
   ArrayView(vector.data(), vector.size())
 {
@@ -463,7 +460,7 @@ inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
 
 template <typename ElementType, typename MemorySpaceType>
 inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
-  std::vector<typename std::remove_cv<value_type>::type> &vector)
+  std::vector<std::remove_cv_t<value_type>> &vector)
   : // use delegating constructor
   ArrayView(vector.data(), vector.size())
 {}
@@ -473,7 +470,7 @@ inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
 template <typename ElementType, typename MemorySpaceType>
 template <std::size_t N>
 inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
-  const std::array<typename std::remove_cv<value_type>::type, N> &vector)
+  const std::array<std::remove_cv_t<value_type>, N> &vector)
   : // use delegating constructor
   ArrayView(vector.data(), vector.size())
 {
@@ -507,7 +504,7 @@ inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
 template <typename ElementType, typename MemorySpaceType>
 template <std::size_t N>
 inline ArrayView<ElementType, MemorySpaceType>::ArrayView(
-  std::array<typename std::remove_cv<value_type>::type, N> &vector)
+  std::array<std::remove_cv_t<value_type>, N> &vector)
   : // use delegating constructor
   ArrayView(vector.data(), vector.size())
 {}
@@ -528,8 +525,8 @@ ArrayView<ElementType, MemorySpaceType>::operator==(
 template <typename ElementType, typename MemorySpaceType>
 inline bool
 ArrayView<ElementType, MemorySpaceType>::operator==(
-  const ArrayView<typename std::remove_cv<value_type>::type, MemorySpaceType>
-    &other_view) const
+  const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType> &other_view)
+  const
 {
   return (other_view.data() == starting_element) &&
          (other_view.size() == n_elements);
@@ -563,8 +560,8 @@ inline DEAL_II_HOST_DEVICE
 template <typename ElementType, typename MemorySpaceType>
 inline bool
 ArrayView<ElementType, MemorySpaceType>::operator!=(
-  const ArrayView<typename std::remove_cv<value_type>::type, MemorySpaceType>
-    &other_view) const
+  const ArrayView<std::remove_cv_t<value_type>, MemorySpaceType> &other_view)
+  const
 {
   return !(*this == other_view);
 }
index ea0f024f93ed30c7737c2149a1cb387d4f762afe..baabdcf5707e30298e6567395409b78bfc791b60 100644 (file)
@@ -85,8 +85,8 @@ namespace Utilities
      * An alias to the stored std::tuple type. Only copy constructible
      * objects are allowed as tuple members.
      */
-    using TupleType = std::tuple<typename std::remove_cv<
-      typename std::remove_reference<FunctionArgs>::type>::type...>;
+    using TupleType =
+      std::tuple<std::remove_cv_t<std::remove_reference_t<FunctionArgs>>...>;
 
     /**
      * Construct a MutableBind object specifying the function, and
index 664f5d15e14dd574822c75810aebf648cf7816b3..7e15b5f6ba7f559fcad838a5112dc7973a3a42ba 100644 (file)
@@ -2279,9 +2279,8 @@ namespace internal
     {
       // `OtherNumber` is either `const Number` (evaluate()) or `Number`
       // (integrate())
-      static_assert(
-        std::is_same_v<Number, typename std::remove_const<OtherNumber>::type>,
-        "Type of Number and of OtherNumber do not match.");
+      static_assert(std::is_same_v<Number, std::remove_const_t<OtherNumber>>,
+                    "Type of Number and of OtherNumber do not match.");
 
       const auto element_type = fe_eval.get_shape_info().element_type;
       using ElementType       = MatrixFreeFunctions::ElementType;
index 617670e34750802fb77f4b1455c29d9a1cc5263a..225c777f66ab9ea5cf4aad72e6b11d349c77c0df 100644 (file)
@@ -4228,9 +4228,9 @@ namespace internal
     for (unsigned int d = 0; d < n_components; ++d)
       src_data.second[d] = get_shared_vector_data(
         const_cast<typename internal::BlockVectorSelector<
-          typename std::remove_const<VectorType>::type,
-          IsBlockVector<typename std::remove_const<VectorType>::type>::value>::
-                     BaseVectorType *>(src_data.first[d]),
+          std::remove_const_t<VectorType>,
+          IsBlockVector<std::remove_const_t<VectorType>>::value>::BaseVectorType
+                     *>(src_data.first[d]),
         is_valid_mode_for_sm,
         active_fe_index,
         dof_info);
index c65c601b7fe5accdc019ac047bf5afb5442c0895..bfdfb353651d05f0b75d3d2f9d9f28fac1e3f1c7 100644 (file)
@@ -116,7 +116,7 @@ namespace internal
     static const bool value =
       has_begin<T> &&
       (has_local_element<T> ||
-       is_serial_vector<typename std::remove_const<T>::type>::value) &&
+       is_serial_vector<std::remove_const_t<T>>::value) &&
       std::is_same_v<typename T::value_type, Number>;
   };
 
index 6f8e7dd791360f5106a65702c3c7523a01bca04d..7035cf5343104324ba1c10e46ef3f742a4da3f56 100644 (file)
@@ -473,14 +473,13 @@ namespace SUNDIALS
 #  endif
                                          )
       : vector_ptr(
-          create_nvector(
-            new NVectorContent<typename std::remove_const<VectorType>::type>(
-              &vector)
+          create_nvector(new NVectorContent<std::remove_const_t<VectorType>>(
+                           &vector)
 #  if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
-              ,
-            nvector_context
+                           ,
+                         nvector_context
 #  endif
-            ),
+                         ),
           [](N_Vector v) { N_VDestroy(v); })
     {}
 
index 15d5f72a44092f356ceb6e50df511402294faaa5..24370c30f9e05983db848ccabe40323ecc3fa200 100644 (file)
@@ -26,8 +26,7 @@ template <typename T>
 constexpr bool
 is_const_reference()
 {
-  return std::is_reference_v<T> &&
-         std::is_const_v<typename std::remove_reference<T>::type>;
+  return std::is_reference_v<T> && std::is_const_v<std::remove_reference_t<T>>;
 }
 
 void
index a1daab5d20371c1e1261facc96bae243f71e3f54..8764157f63915339f33b3561097937e6b6d36956 100644 (file)
@@ -28,8 +28,7 @@ template <typename T>
 constexpr bool
 is_const_reference()
 {
-  return std::is_reference_v<T> &&
-         std::is_const_v<typename std::remove_reference<T>::type>;
+  return std::is_reference_v<T> && std::is_const_v<std::remove_reference_t<T>>;
 }
 
 void
index 6adbb62535018ddfbc47c7bb3c880f76d1faaa2d..dbdacb2fe464a5974340f3520fae95a4c5d25797 100644 (file)
@@ -54,8 +54,8 @@ test_view(const Vector<double> &            solution,
           const FEValuesExtractors::Scalar &extractor,
           const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &     fe_values_view = fe_values[extractor];
   const NumberType tolerance = std::is_same_v<NumberType, float> ? 1e-5 : 1e-13;
 
@@ -148,8 +148,8 @@ test_view(const Vector<double> &            solution,
           const FEValuesExtractors::Vector &extractor,
           const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &     fe_values_view = fe_values[extractor];
   const NumberType tolerance = std::is_same_v<NumberType, float> ? 1e-5 : 1e-13;
 
@@ -290,8 +290,8 @@ test_view(const Vector<double> &                        solution,
           const FEValuesExtractors::SymmetricTensor<2> &extractor,
           const std::vector<NumberType> &               local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &     fe_values_view = fe_values[extractor];
   const NumberType tolerance = std::is_same_v<NumberType, float> ? 1e-5 : 1e-13;
 
@@ -339,8 +339,8 @@ test_view(const Vector<double> &               solution,
           const FEValuesExtractors::Tensor<2> &extractor,
           const std::vector<NumberType> &      local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &fe_values_view = fe_values[extractor];
 
   // Typedefs
index d39483ff55e18afb2f36882293672a6b25eaf49c..07930f87c923ff0a9c3410eccc0a6b9dc3764357 100644 (file)
@@ -60,8 +60,8 @@ test_view(const Vector<double> &            solution,
           const FEValuesExtractors::Scalar &extractor,
           const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &fe_values_view = fe_values[extractor];
 
   // Typedefs
@@ -106,8 +106,8 @@ test_view(const Vector<double> &            solution,
           const FEValuesExtractors::Vector &extractor,
           const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &fe_values_view = fe_values[extractor];
 
   // Typedefs
@@ -171,8 +171,8 @@ test_view(const Vector<double> &                        solution,
           const FEValuesExtractors::SymmetricTensor<2> &extractor,
           const std::vector<NumberType> &               local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &fe_values_view = fe_values[extractor];
 
   // Typedefs
@@ -203,8 +203,8 @@ test_view(const Vector<double> &               solution,
           const FEValuesExtractors::Tensor<2> &extractor,
           const std::vector<NumberType> &      local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_values[extractor])>::type>::type;
+  using View = std::remove_reference_t<
+    std::remove_const_t<decltype(fe_values[extractor])>>;
   const View &fe_values_view = fe_values[extractor];
 
   // Typedefs
index 21316bfd5422bb5b6e44b4d083b0d91d017bfc7b..502790a4569b1695d93aa34a643cf1f3526815af 100644 (file)
@@ -55,8 +55,8 @@ test_feiv_view(const Vector<double> &            solution,
                const FEValuesExtractors::Scalar &extractor,
                const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_iv[extractor])>::type>::type;
+  using View =
+    std::remove_reference_t<std::remove_const_t<decltype(fe_iv[extractor])>>;
   const View &fe_iv_view = fe_iv[extractor];
 
   // Typedefs
@@ -176,8 +176,8 @@ test_feiv_view(const Vector<double> &            solution,
                const FEValuesExtractors::Vector &extractor,
                const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_iv[extractor])>::type>::type;
+  using View =
+    std::remove_reference_t<std::remove_const_t<decltype(fe_iv[extractor])>>;
   const View &fe_iv_view = fe_iv[extractor];
 
   // Typedefs
index d54d01389b394335aded9f5046de555c49152149..c9915d344458c5171db3ba9ef8bd39231c2b911f 100644 (file)
@@ -63,8 +63,8 @@ test_feiv_view(const Vector<double> &            solution,
                const FEValuesExtractors::Scalar &extractor,
                const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_iv[extractor])>::type>::type;
+  using View =
+    std::remove_reference_t<std::remove_const_t<decltype(fe_iv[extractor])>>;
   const View &fe_iv_view = fe_iv[extractor];
 
   // Typedefs
@@ -137,8 +137,8 @@ test_feiv_view(const Vector<double> &            solution,
                const FEValuesExtractors::Vector &extractor,
                const std::vector<NumberType> &   local_dof_values)
 {
-  using View = typename std::remove_reference<
-    typename std::remove_const<decltype(fe_iv[extractor])>::type>::type;
+  using View =
+    std::remove_reference_t<std::remove_const_t<decltype(fe_iv[extractor])>>;
   const View &fe_iv_view = fe_iv[extractor];
 
   // Typedefs
index f2e45cb7aa05709f9bc251d14f92b4a7263a75fb..baa2a10a9ea49e31d5779bef304892a7dc5d2c10 100644 (file)
@@ -268,8 +268,7 @@ test(const unsigned int degree)
         auto &      x,
         auto &      b) -> std::pair<unsigned int, double> {
     ReductionControl reduction_control(2000, 1e-7, 1e-2);
-    SolverCG<typename std::remove_reference<decltype(x)>::type> solver(
-      reduction_control);
+    SolverCG<std::remove_reference_t<decltype(x)>> solver(reduction_control);
 
     solver.solve(poisson_operator, x, b, PreconditionIdentity());
 
index 37771aeed6b39f97eb3275c133f3e4c854f95072..99f5a1c5e5894f61617ea9d72730430d2e3ac3c8 100644 (file)
@@ -184,9 +184,8 @@ test(const unsigned int v, const unsigned int degree, const bool do_helmholtz)
     [&](const auto &poisson_operator,
         auto &      x,
         auto &      b) -> std::pair<unsigned int, double> {
-    ReductionControl reduction_control;
-    SolverCG<typename std::remove_reference<decltype(x)>::type> solver(
-      reduction_control);
+    ReductionControl                               reduction_control;
+    SolverCG<std::remove_reference_t<decltype(x)>> solver(reduction_control);
     solver.solve(poisson_operator, x, b, PreconditionIdentity());
 
     if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
index ed29a62f821fa3f6443ee9f47ab9e412bba4b0ef..04de2de173599de53f52be28c04cd5ff88c0ce50 100644 (file)
@@ -181,8 +181,7 @@ test(const unsigned version, const unsigned int degree, const bool do_helmholtz)
         auto &      x,
         auto &      b) -> std::tuple<unsigned int, double, double, double> {
     ReductionControl reduction_control(1000, 1e-10, 1e-4);
-    SolverCG<typename std::remove_reference<decltype(x)>::type> solver(
-      reduction_control);
+    SolverCG<std::remove_reference_t<decltype(x)>> solver(reduction_control);
     solver.solve(poisson_operator, x, b, PreconditionIdentity());
 
     if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
index 57d3adbb6f17b982e9ca619d64b2e22683965343..0c2df1500f9ad87de0b9cc51230ed2fbf5129116 100644 (file)
@@ -327,8 +327,7 @@ test(const unsigned int degree)
         auto &      x,
         auto &      b) -> std::pair<unsigned int, double> {
     ReductionControl reduction_control(1000, 1e-7, 1e-3);
-    SolverCG<typename std::remove_reference<decltype(x)>::type> solver(
-      reduction_control);
+    SolverCG<std::remove_reference_t<decltype(x)>> solver(reduction_control);
 
     try
       {
index 4d95f9a677d4fe36e7fffb51d6c428a2d612bb61..4e4f275554f3fe8760597befd2f67347ba72e051 100644 (file)
@@ -278,8 +278,7 @@ test(const unsigned version, const unsigned int degree)
         auto &      x,
         auto &      b) -> std::pair<unsigned int, double> {
     ReductionControl reduction_control(2000, 1e-7, 1e-2);
-    SolverCG<typename std::remove_reference<decltype(x)>::type> solver(
-      reduction_control);
+    SolverCG<std::remove_reference_t<decltype(x)>> solver(reduction_control);
 
     solver.solve(poisson_operator, x, b, PreconditionIdentity());
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.