]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer std::decay_t over std::decay::type. 15765/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 19 Jul 2023 17:13:31 +0000 (11:13 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 19 Jul 2023 17:13:31 +0000 (11:13 -0600)
15 files changed:
include/deal.II/base/array_view.h
include/deal.II/base/mpi.templates.h
include/deal.II/base/numbers.h
include/deal.II/base/patterns.h
include/deal.II/base/template_constraints.h
include/deal.II/differentiation/ad/ad_number_traits.h
include/deal.II/differentiation/ad/adolc_number_types.h
include/deal.II/differentiation/ad/sacado_number_types.h
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/fe/fe_system.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/trilinos_sparsity_pattern.h
tests/grid/filtered_iterator_08.cc
tests/physics/notation-kelvin_01.cc
tests/physics/notation-kelvin_02.cc

index 61453aeb25ab796010ddc753bab2c57fee5a6ed7..6f4d8922c1097a32b1a3b49dd2dcfe000bd5eb6c 100644 (file)
@@ -651,7 +651,7 @@ namespace internal
     is_contiguous(const Iterator &first, const Iterator &last)
     {
       const auto n = std::distance(first, last);
-      for (typename std::decay<decltype(n)>::type i = 0; i < n; ++i)
+      for (std::decay_t<decltype(n)> i = 0; i < n; ++i)
         if (std::addressof(*(std::next(first, i))) !=
             std::next(std::addressof(*first), i))
           return false;
index e38c42252eaf25f52ad8c3b18e0774ed6bd9b84a..3f6b8815d575ba8b5292128e6c16bd78b575035c 100644 (file)
@@ -157,8 +157,7 @@ namespace Utilities
     void
     sum(const T &values, const MPI_Comm mpi_communicator, U &sums)
     {
-      static_assert(std::is_same_v<typename std::decay<T>::type,
-                                   typename std::decay<U>::type>,
+      static_assert(std::is_same_v<std::decay_t<T>, std::decay_t<U>>,
                     "Input and output arguments must have the same type!");
       const auto array_view_values = make_array_view(values);
       using const_type =
@@ -272,8 +271,7 @@ namespace Utilities
     void
     max(const T &values, const MPI_Comm mpi_communicator, U &maxima)
     {
-      static_assert(std::is_same_v<typename std::decay<T>::type,
-                                   typename std::decay<U>::type>,
+      static_assert(std::is_same_v<std::decay_t<T>, std::decay_t<U>>,
                     "Input and output arguments must have the same type!");
       const auto array_view_values = make_array_view(values);
       using const_type =
@@ -314,8 +312,7 @@ namespace Utilities
     void
     min(const T &values, const MPI_Comm mpi_communicator, U &minima)
     {
-      static_assert(std::is_same_v<typename std::decay<T>::type,
-                                   typename std::decay<U>::type>,
+      static_assert(std::is_same_v<std::decay_t<T>, std::decay_t<U>>,
                     "Input and output arguments must have the same type!");
       const auto array_view_values = make_array_view(values);
       using const_type =
@@ -359,8 +356,7 @@ namespace Utilities
     void
     logical_or(const T &values, const MPI_Comm mpi_communicator, U &results)
     {
-      static_assert(std::is_same_v<typename std::decay<T>::type,
-                                   typename std::decay<U>::type>,
+      static_assert(std::is_same_v<std::decay_t<T>, std::decay_t<U>>,
                     "Input and output arguments must have the same type!");
 
       static_assert(std::is_integral<typename T::value_type>::value,
index 9378caa00c39f10c503ac9e4a1b2b733187da3f0..1c9dd9606dd323b1bb783b84ab8ee81f75e2f5af 100644 (file)
@@ -715,8 +715,7 @@ namespace internal
     template <typename F>
     static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T
     value(const F &f,
-          std::enable_if_t<!std::is_same_v<typename std::decay<T>::type,
-                                           typename std::decay<F>::type> &&
+          std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
                            std::is_constructible<T, F>::value> * = nullptr)
     {
       return T(f);
@@ -726,8 +725,7 @@ namespace internal
     template <typename F>
     static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T
     value(const F &f,
-          std::enable_if_t<!std::is_same_v<typename std::decay<T>::type,
-                                           typename std::decay<F>::type> &&
+          std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
                            !std::is_constructible<T, F>::value &&
                            is_explicitly_convertible<const F, T>::value> * =
             nullptr)
@@ -743,8 +741,7 @@ namespace internal
     static T
     value(
       const F &f,
-      std::enable_if_t<!std::is_same_v<typename std::decay<T>::type,
-                                       typename std::decay<F>::type> &&
+      std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::decay_t<F>> &&
                        !std::is_constructible<T, F>::value &&
                        !is_explicitly_convertible<const F, T>::value &&
                        Differentiation::AD::is_ad_number<F>::value> * = nullptr)
index 9aaf1ed4787be6f1a67b63de84c547a6d9927d64..e0d71fad932a4cbce51abad681aae5f8cec05167 100644 (file)
@@ -1629,14 +1629,14 @@ namespace Patterns
     struct is_list_compatible
     {
       static constexpr bool const value =
-        internal::is_list_compatible<typename std::decay<T>::type>::value;
+        internal::is_list_compatible<std::decay_t<T>>::value;
     };
 
     template <typename T>
     struct is_map_compatible
     {
       static constexpr bool const value =
-        internal::is_map_compatible<typename std::decay<T>::type>::value;
+        internal::is_map_compatible<std::decay_t<T>>::value;
     };
 
     namespace internal
index 9255d41f9418a0fcd377b245b3d30c53c96d9923..af593ce065753f646487e970d3e69e7262ed2ac4 100644 (file)
@@ -459,8 +459,7 @@ template <typename T, typename U>
 struct ProductType
 {
   using type =
-    typename internal::ProductTypeImpl<typename std::decay<T>::type,
-                                       typename std::decay<U>::type>::type;
+    typename internal::ProductTypeImpl<std::decay_t<T>, std::decay_t<U>>::type;
 };
 
 namespace internal
index ea0ff92cc0887f65c4dc1cd07f1fd2112830f805..270eaeff1cefbb96a652c2cc7301c0b8cbe50648 100644 (file)
@@ -442,8 +442,7 @@ namespace Differentiation
      */
     template <typename NumberType>
     struct is_ad_number
-      : internal::HasRequiredADInfo<
-          ADNumberTraits<typename std::decay<NumberType>::type>>
+      : internal::HasRequiredADInfo<ADNumberTraits<std::decay_t<NumberType>>>
     {};
 
 
@@ -454,8 +453,7 @@ namespace Differentiation
     template <typename NumberType>
     struct is_taped_ad_number<
       NumberType,
-      std::enable_if_t<
-        ADNumberTraits<typename std::decay<NumberType>::type>::is_taped>>
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::is_taped>>
       : std::true_type
     {};
 
@@ -467,8 +465,7 @@ namespace Differentiation
     template <typename NumberType>
     struct is_tapeless_ad_number<
       NumberType,
-      std::enable_if_t<
-        ADNumberTraits<typename std::decay<NumberType>::type>::is_tapeless>>
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::is_tapeless>>
       : std::true_type
     {};
 
@@ -482,7 +479,7 @@ namespace Differentiation
     struct is_real_valued_ad_number<
       NumberType,
       std::enable_if_t<
-        ADNumberTraits<typename std::decay<NumberType>::type>::is_real_valued>>
+        ADNumberTraits<std::decay_t<NumberType>>::is_real_valued>>
       : std::true_type
     {};
 
@@ -495,8 +492,8 @@ namespace Differentiation
     template <typename NumberType>
     struct is_complex_valued_ad_number<
       NumberType,
-      std::enable_if_t<ADNumberTraits<
-        typename std::decay<NumberType>::type>::is_complex_valued>>
+      std::enable_if_t<
+        ADNumberTraits<std::decay_t<NumberType>>::is_complex_valued>>
       : std::true_type
     {};
 
index 81b4968f9a22341789e0a9fe7a57cccbd630ff3d..3c7dd50e5c5f140e8f1301e2098b902f751e7fa1 100644 (file)
@@ -460,9 +460,8 @@ namespace Differentiation
     template <typename NumberType>
     struct is_adolc_taped_number<
       NumberType,
-      std::enable_if_t<ADNumberTraits<typename std::decay<NumberType>::type>::
-                         type_code == NumberTypes::adolc_taped>>
-      : std::true_type
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                       NumberTypes::adolc_taped>> : std::true_type
     {};
 
 
@@ -473,9 +472,8 @@ namespace Differentiation
     template <typename NumberType>
     struct is_adolc_tapeless_number<
       NumberType,
-      std::enable_if_t<ADNumberTraits<typename std::decay<NumberType>::type>::
-                         type_code == NumberTypes::adolc_tapeless>>
-      : std::true_type
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                       NumberTypes::adolc_tapeless>> : std::true_type
     {};
 
 
index bc120934912308846a1eb348ab552ddf07139771..5e7553e568d2e40520dc867fbea008c8b4abdfec 100644 (file)
@@ -184,9 +184,9 @@ namespace Differentiation
        * templates used in the above specializations.
        */
       template <typename Number>
-      struct SacadoNumberInfo<Number,
-                              std::enable_if_t<std::is_arithmetic<
-                                typename std::decay<Number>::type>::value>>
+      struct SacadoNumberInfo<
+        Number,
+        std::enable_if_t<std::is_arithmetic<std::decay_t<Number>>::value>>
       {
         static const unsigned int n_supported_derivative_levels = 0;
       };
@@ -849,11 +849,10 @@ namespace Differentiation
     template <typename NumberType>
     struct is_sacado_dfad_number<
       NumberType,
-      std::enable_if_t<
-        ADNumberTraits<typename std::decay<NumberType>::type>::type_code ==
-          NumberTypes::sacado_dfad ||
-        ADNumberTraits<typename std::decay<NumberType>::type>::type_code ==
-          NumberTypes::sacado_dfad_dfad>> : std::true_type
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                         NumberTypes::sacado_dfad ||
+                       ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                         NumberTypes::sacado_dfad_dfad>> : std::true_type
     {};
 
 
@@ -870,11 +869,10 @@ namespace Differentiation
     template <typename NumberType>
     struct is_sacado_rad_number<
       NumberType,
-      std::enable_if_t<
-        ADNumberTraits<typename std::decay<NumberType>::type>::type_code ==
-          NumberTypes::sacado_rad ||
-        ADNumberTraits<typename std::decay<NumberType>::type>::type_code ==
-          NumberTypes::sacado_rad_dfad>> : std::true_type
+      std::enable_if_t<ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                         NumberTypes::sacado_rad ||
+                       ADNumberTraits<std::decay_t<NumberType>>::type_code ==
+                         NumberTypes::sacado_rad_dfad>> : std::true_type
     {};
 
 
index 4ee7bd40e5c96fd3b5e65cfb72dd37786b743884..8239e7f89352039a1dcc7ce2af1424b70a20b054 100644 (file)
@@ -2133,9 +2133,8 @@ namespace internal
         if (accessor.dof_handler->hp_capability_enabled == false)
           return DoFHandler<dim, spacedim>::default_fe_index;
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2162,9 +2161,8 @@ namespace internal
             return;
           }
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2190,9 +2188,8 @@ namespace internal
         if (accessor.dof_handler->hp_capability_enabled == false)
           return DoFHandler<dim, spacedim>::default_fe_index;
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2224,9 +2221,8 @@ namespace internal
             return;
           }
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2252,9 +2248,8 @@ namespace internal
         if (accessor.dof_handler->hp_capability_enabled == false)
           return false;
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2279,9 +2274,8 @@ namespace internal
         if (accessor.dof_handler->hp_capability_enabled == false)
           return;
 
-        Assert(
-          accessor.dof_handler != nullptr,
-          (typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
+        Assert(accessor.dof_handler != nullptr,
+               (typename std::decay_t<decltype(accessor)>::ExcInvalidObject()));
         Assert(static_cast<unsigned int>(accessor.level()) <
                  accessor.dof_handler->hp_cell_future_fe_indices.size(),
                ExcMessage("DoFHandler not initialized"));
@@ -2832,12 +2826,12 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
                              OutputVector &  global_destination) const
 {
   Assert(this->dof_handler != nullptr,
-         (typename std::decay<decltype(*this)>::type::ExcInvalidObject()));
+         (typename std::decay_t<decltype(*this)>::ExcInvalidObject()));
   Assert(static_cast<unsigned int>(local_source_end - local_source_begin) ==
            this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_destination.size(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
 
   Assert(!this->has_children(), ExcMessage("Cell must be active"));
 
@@ -2871,12 +2865,12 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
     OutputVector &  global_destination) const
 {
   Assert(this->dof_handler != nullptr,
-         (typename std::decay<decltype(*this)>::type::ExcInvalidObject()));
+         (typename std::decay_t<decltype(*this)>::ExcInvalidObject()));
   Assert(local_source_end - local_source_begin ==
            this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_destination.size(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
 
   Assert(!this->has_children(), ExcMessage("Cell must be active."));
 
@@ -2902,15 +2896,15 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
                              OutputMatrix &            global_destination) const
 {
   Assert(this->dof_handler != nullptr,
-         (typename std::decay<decltype(*this)>::type::ExcInvalidObject()));
+         (typename std::decay_t<decltype(*this)>::ExcInvalidObject()));
   Assert(local_source.m() == this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(local_source.n() == this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_destination.m(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_destination.n(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
 
   Assert(!this->has_children(), ExcMessage("Cell must be active."));
 
@@ -2941,19 +2935,19 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
                              OutputVector &            global_vector) const
 {
   Assert(this->dof_handler != nullptr,
-         (typename std::decay<decltype(*this)>::type::ExcInvalidObject()));
+         (typename std::decay_t<decltype(*this)>::ExcInvalidObject()));
   Assert(local_matrix.m() == this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(local_matrix.n() == this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_matrix.m(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_matrix.n(),
-         (typename std::decay<decltype(*this)>::type::ExcMatrixDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcMatrixDoesNotMatch()));
   Assert(local_vector.size() == this->get_fe().n_dofs_per_cell(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
   Assert(this->dof_handler->n_dofs() == global_vector.size(),
-         (typename std::decay<decltype(*this)>::type::ExcVectorDoesNotMatch()));
+         (typename std::decay_t<decltype(*this)>::ExcVectorDoesNotMatch()));
 
   Assert(!this->has_children(), ExcMessage("Cell must be active."));
 
index 7b8be45ed61280a1a0ec516bfe391a653b2f6c5a..90e6a44baf31957af8dc56adb7d0c12775058ff8 100644 (file)
@@ -537,11 +537,11 @@ public:
   template <
     class... FEPairs,
     typename = enable_if_all_t<
-      (std::is_same_v<typename std::decay<FEPairs>::type,
+      (std::is_same_v<std::decay_t<FEPairs>,
                       std::pair<std::unique_ptr<FiniteElement<dim, spacedim>>,
                                 unsigned int>> ||
        std::is_base_of_v<FiniteElement<dim, spacedim>,
-                         typename std::decay<FEPairs>::type>)...>>
+                         std::decay_t<FEPairs>>)...>>
   FESystem(FEPairs &&...fe_pairs);
 
   /**
index 711ccd331f5101ef08ca103acd2ff1c03ae8b5bf..edc3178f69ff110ed0fb5d706c866e0ce4fb285a 100644 (file)
@@ -619,7 +619,7 @@ namespace LinearAlgebra
     const auto *new_values = target_vector.getData().get();
     const auto  size       = target_vector.getLocalLength();
 
-    using size_type = typename std::decay<decltype(size)>::type;
+    using size_type = std::decay_t<decltype(size)>;
 
     Assert(size == 0 || values != nullptr, ExcInternalError("Export failed."));
     AssertDimension(size, stored_elements.n_elements());
index 5bed68193cb2b4764352c04994e24f48ee65eccb..cac8a87bb9fb3dcd6d267198a96234109a8fbf12 100644 (file)
@@ -1261,7 +1261,7 @@ namespace TrilinosWrappers
 
     TrilinosWrappers::types::int_type *col_index_ptr =
       reinterpret_cast<TrilinosWrappers::types::int_type *>(
-        const_cast<typename std::decay<decltype(*begin)>::type *>(&*begin));
+        const_cast<std::decay_t<decltype(*begin)> *>(&*begin));
     // Check at least for the first index that the conversion actually works
     AssertDimension(*col_index_ptr, *begin);
     TrilinosWrappers::types::int_type trilinos_row_index = row;
index 1cf0dae58fe6f1cd9e2768c3d61c25d759a4daaf..16991e5a83c28a92fac59069455d490f7ebf7b43 100644 (file)
@@ -63,8 +63,8 @@ test()
           // This commented out code block identifies that the filtered iterator
           // is of a different type to that returned by cell->neighbor()
           //
-          // using C1 = typename std::decay<decltype(cell)>::type;
-          // using C2 = typename std::decay<decltype(cell_neighbor)>::type;
+          // using C1 = std::decay_t<decltype(cell)>;
+          // using C2 = std::decay_t<decltype(cell_neighbor)>;
           // static_assert(std::is_same_v<C1, C2>,
           //               "Cell iterator types are not identical.");
 
index 12f2c0183bd11b4d07dc92aa3426237e669963d0..eb9813e43ce50a2742ed03d5d891730c42f70436 100644 (file)
@@ -128,7 +128,7 @@ test_scalars()
   const Vector<double>     vA = Notation::Kelvin::to_vector(A);
   const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-  using InpType      = typename std::decay<decltype(A)>::type;
+  using InpType      = std::decay_t<decltype(A)>;
   const auto vA_conv = Notation::Kelvin::to_tensor<InpType>(vA);
   const auto mA_conv = Notation::Kelvin::to_tensor<InpType>(mA);
 
@@ -147,7 +147,7 @@ test_rank_0_tensors()
   const Vector<double>     vA = Notation::Kelvin::to_vector(A);
   const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-  using InpType = typename std::decay<decltype(A)>::type;
+  using InpType = std::decay_t<decltype(A)>;
   // Here and below we need both types to work around a problem present in GCC
   // 5.4.0 in which the compiler does not correctly handle SFINAE with
   // static_assert(). This was fixed by GCC 9.
@@ -169,7 +169,7 @@ test_rank_1_tensors()
 
   const Vector<double> vA = Notation::Kelvin::to_vector(A);
 
-  using InpType      = typename std::decay<decltype(A)>::type;
+  using InpType      = std::decay_t<decltype(A)>;
   const auto vA_conv = Notation::Kelvin::to_tensor<InpType, double>(vA);
 
   Assert((vA_conv - A).norm() < 1e-12,
@@ -188,7 +188,7 @@ test_rank_2_tensors()
     const Vector<double>     vA = Notation::Kelvin::to_vector(A);
     const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto vA_conv = Notation::Kelvin::to_tensor<InpType, double>(vA);
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
@@ -206,7 +206,7 @@ test_rank_2_tensors()
     const Vector<double>     vA = Notation::Kelvin::to_vector(A);
     const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto vA_conv = Notation::Kelvin::to_tensor<InpType, double>(vA);
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
@@ -229,7 +229,7 @@ test_rank_3_tensors()
     const FullMatrix<double> mA =
       Notation::Kelvin::to_matrix<dim, Tensor<1, dim>, Tensor<2, dim>>(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
@@ -244,7 +244,7 @@ test_rank_3_tensors()
     const FullMatrix<double> mA =
       Notation::Kelvin::to_matrix<dim, Tensor<2, dim>, Tensor<1, dim>>(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
@@ -260,7 +260,7 @@ test_rank_3_tensors()
       Notation::Kelvin::to_matrix<dim, SymmetricTensor<2, dim>, Tensor<1, dim>>(
         A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
@@ -276,7 +276,7 @@ test_rank_3_tensors()
       Notation::Kelvin::to_matrix<dim, Tensor<1, dim>, SymmetricTensor<2, dim>>(
         A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
@@ -295,7 +295,7 @@ test_rank_4_tensors()
 
     const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
@@ -309,7 +309,7 @@ test_rank_4_tensors()
 
     const FullMatrix<double> mA = Notation::Kelvin::to_matrix(A);
 
-    using InpType      = typename std::decay<decltype(A)>::type;
+    using InpType      = std::decay_t<decltype(A)>;
     const auto mA_conv = Notation::Kelvin::to_tensor<InpType, double>(mA);
 
     Assert((mA_conv - A).norm() < 1e-12,
index 66e89cda4beb424012d88b41b5d663ba10bab3c1..27591234f8d5bae12fd7675629f3b737a25d87b0 100644 (file)
@@ -135,9 +135,9 @@ test_scalars()
   Vector<double>           vB(mC.m());
   mC.vmult(vB, vA);
 
-  using InpVecType = typename std::decay<decltype(A)>::type;
-  using ResVecType = typename std::decay<decltype(B)>::type;
-  using InpMatType = typename std::decay<decltype(C)>::type;
+  using InpVecType = std::decay_t<decltype(A)>;
+  using ResVecType = std::decay_t<decltype(B)>;
+  using InpMatType = std::decay_t<decltype(C)>;
   // Here and below we need both types to work around a problem present in GCC
   // 5.4.0 in which the compiler does not correctly handle SFINAE with
   // static_assert(). This was fixed by GCC 9.
@@ -178,9 +178,9 @@ test_rank_0_tensors()
   Vector<double>           vB(mC.m());
   mC.vmult(vB, vA);
 
-  using InpVecType  = typename std::decay<decltype(A)>::type;
-  using ResVecType  = typename std::decay<decltype(B)>::type;
-  using InpMatType  = typename std::decay<decltype(C)>::type;
+  using InpVecType  = std::decay_t<decltype(A)>;
+  using ResVecType  = std::decay_t<decltype(B)>;
+  using InpMatType  = std::decay_t<decltype(C)>;
   const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
   const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
   const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -222,9 +222,9 @@ test_rank_1_2_tensors()
     Vector<double>           vB(mC.m());
     mC.vmult(vB, vA);
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -262,9 +262,9 @@ test_rank_1_2_tensors()
     Vector<double>           vB(mC.m());
     mC.vmult(vB, vA);
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -307,9 +307,9 @@ test_rank_2_4_tensors()
     Vector<double>           vB(mC.m());
     mC.vmult(vB, vA);
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -347,9 +347,9 @@ test_rank_2_4_tensors()
     Vector<double>           vB(mC.m());
     mC.vmult(vB, vA);
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -390,9 +390,9 @@ test_rank_2_4_tensors()
     Vector<double>           vB(mC.m());
     mC.vmult(vB, vA);
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -437,9 +437,9 @@ test_rank_3_tensors()
     Vector<double>           vB(mC.n()); // Note result size
     mC.Tvmult(vB, vA);                   // Note transpose vmult
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -481,9 +481,9 @@ test_rank_3_tensors()
     Vector<double> vB(mC.m()); // Note result size
     mC.vmult(vB, vA);          // Note transpose vmult
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -526,9 +526,9 @@ test_rank_3_tensors()
     Vector<double> vB(mC.n()); // Note result size
     mC.Tvmult(vB, vA);         // Note transpose vmult
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);
@@ -571,9 +571,9 @@ test_rank_3_tensors()
     Vector<double> vB(mC.m()); // Note result size
     mC.vmult(vB, vA);          // Note transpose vmult
 
-    using InpVecType  = typename std::decay<decltype(A)>::type;
-    using ResVecType  = typename std::decay<decltype(B)>::type;
-    using InpMatType  = typename std::decay<decltype(C)>::type;
+    using InpVecType  = std::decay_t<decltype(A)>;
+    using ResVecType  = std::decay_t<decltype(B)>;
+    using InpMatType  = std::decay_t<decltype(C)>;
     const auto A_conv = Notation::Kelvin::to_tensor<InpVecType, double>(vA);
     const auto B_conv = Notation::Kelvin::to_tensor<ResVecType, double>(vB);
     const auto C_conv = Notation::Kelvin::to_tensor<InpMatType, double>(mC);

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.