]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer std::is_base_of_v over std::is_base_of::value. 15746/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 14 Jul 2023 18:37:26 +0000 (12:37 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 14 Jul 2023 18:37:26 +0000 (12:37 -0600)
include/deal.II/base/exceptions.h
include/deal.II/base/function_lib.h
include/deal.II/base/quadrature_point_data.h
include/deal.II/base/template_constraints.h
include/deal.II/differentiation/sd/symengine_scalar_operations.h
include/deal.II/fe/fe_system.h
include/deal.II/lac/linear_operator.h
include/deal.II/lac/trilinos_sparse_matrix.h

index a23c23c3b15967641e9864fea78aa1362983ad7d..2498abd35c4c2f1363c8a9d7c05938636447bc43 100644 (file)
@@ -1482,7 +1482,7 @@ namespace deal_II_exceptions
                         const char *  exc_name,
                         ExceptionType e) noexcept
     {
-      static_assert(std::is_base_of<ExceptionBase, ExceptionType>::value,
+      static_assert(std::is_base_of_v<ExceptionBase, ExceptionType>,
                     "The provided exception must inherit from ExceptionBase.");
       // Fill the fields of the exception object
       e.set_fields(file, line, function, cond, exc_name);
index fcd843efbd89c21ac275d5613dd629a0f7e93867..bf3e239ec22fb2b0c663bc5e173ca1f3b12a8af3 100644 (file)
@@ -1764,7 +1764,7 @@ namespace Functions
   {
     initialized = true;
     static_assert(
-      std::is_base_of<CutOffFunctionBase<1>, CutOffFunctionBaseType<1>>::value,
+      std::is_base_of_v<CutOffFunctionBase<1>, CutOffFunctionBaseType<1>>,
       "You can only construct a CutOffFunctionTensorProduct function from "
       "a class derived from CutOffFunctionBase.");
 
index 5dabd69336401b7664f697667bbe019db1380812..ca622cac120b32fde5a60b889a9e4393190e2148 100644 (file)
@@ -440,7 +440,7 @@ namespace parallel
     {
     public:
       static_assert(
-        std::is_base_of<TransferableQuadraturePointData, DataType>::value,
+        std::is_base_of_v<TransferableQuadraturePointData, DataType>,
         "User's DataType class should be derived from TransferableQuadraturePointData");
 
       /**
@@ -604,7 +604,7 @@ CellDataStorage<CellIteratorType, DataType>::initialize(
   const CellIteratorType &cell,
   const unsigned int      n_q_points)
 {
-  static_assert(std::is_base_of<DataType, T>::value,
+  static_assert(std::is_base_of_v<DataType, T>,
                 "User's T class should be derived from user's DataType class");
   // The first time this method is called, it has to initialize the reference
   // to the triangulation object
@@ -694,7 +694,7 @@ inline std::vector<std::shared_ptr<T>>
 CellDataStorage<CellIteratorType, DataType>::get_data(
   const CellIteratorType &cell)
 {
-  static_assert(std::is_base_of<DataType, T>::value,
+  static_assert(std::is_base_of_v<DataType, T>,
                 "User's T class should be derived from user's DataType class");
   Assert(&cell->get_triangulation() == tria, ExcTriangulationMismatch());
 
@@ -723,7 +723,7 @@ inline std::vector<std::shared_ptr<const T>>
 CellDataStorage<CellIteratorType, DataType>::get_data(
   const CellIteratorType &cell) const
 {
-  static_assert(std::is_base_of<DataType, T>::value,
+  static_assert(std::is_base_of_v<DataType, T>,
                 "User's T class should be derived from user's DataType class");
   Assert(&cell->get_triangulation() == tria, ExcTriangulationMismatch());
 
@@ -748,7 +748,7 @@ inline std::optional<std::vector<std::shared_ptr<T>>>
 CellDataStorage<CellIteratorType, DataType>::try_get_data(
   const CellIteratorType &cell)
 {
-  static_assert(std::is_base_of<DataType, T>::value,
+  static_assert(std::is_base_of_v<DataType, T>,
                 "User's T class should be derived from user's DataType class");
   Assert(&cell->get_triangulation() == tria, ExcTriangulationMismatch());
 
@@ -779,7 +779,7 @@ inline std::optional<std::vector<std::shared_ptr<const T>>>
 CellDataStorage<CellIteratorType, DataType>::try_get_data(
   const CellIteratorType &cell) const
 {
-  static_assert(std::is_base_of<DataType, T>::value,
+  static_assert(std::is_base_of_v<DataType, T>,
                 "User's T class should be derived from user's DataType class");
   Assert(&cell->get_triangulation() == tria, ExcTriangulationMismatch());
 
@@ -822,9 +822,8 @@ pack_cell_data(const CellIteratorType &                           cell,
                const CellDataStorage<CellIteratorType, DataType> *data_storage,
                FullMatrix<double> &                               matrix_data)
 {
-  static_assert(
-    std::is_base_of<TransferableQuadraturePointData, DataType>::value,
-    "User's DataType class should be derived from QPData");
+  static_assert(std::is_base_of_v<TransferableQuadraturePointData, DataType>,
+                "User's DataType class should be derived from QPData");
 
   if (const auto qpd = data_storage->try_get_data(cell))
     {
@@ -860,9 +859,8 @@ unpack_to_cell_data(const CellIteratorType &                     cell,
                     const FullMatrix<double> &                   values_at_qp,
                     CellDataStorage<CellIteratorType, DataType> *data_storage)
 {
-  static_assert(
-    std::is_base_of<TransferableQuadraturePointData, DataType>::value,
-    "User's DataType class should be derived from QPData");
+  static_assert(std::is_base_of_v<TransferableQuadraturePointData, DataType>,
+                "User's DataType class should be derived from QPData");
 
   if (const auto qpd = data_storage->try_get_data(cell))
     {
index 8767b30c96dee21e3d39944b65dd5ece23e441ba..9255d41f9418a0fcd377b245b3d30c53c96d9923 100644 (file)
@@ -202,7 +202,7 @@ template <class Base, class... Derived>
 struct is_base_of_all
 {
   static constexpr bool value = internal::TemplateConstraints::all_true<
-    std::is_base_of<Base, Derived>::value...>::value;
+    std::is_base_of_v<Base, Derived>...>::value;
 };
 
 
index 149902706c00fd82fdf5b9582976a6e57a0d0131..d4edade89fe35493e925707da38ec4cd8887249f 100644 (file)
@@ -304,7 +304,7 @@ namespace Differentiation
               typename ValueType          = double,
               typename SymbolicType,
               typename T = std::enable_if_t<
-                !std::is_base_of<Expression, SymbolicType>::value &&
+                !std::is_base_of_v<Expression, SymbolicType> &&
                 dealii::internal::is_explicitly_convertible<
                   SymbolicType,
                   const SymEngine::RCP<const SymEngine::Basic> &>::value>>
index ee5da98378946682ddfcb24e72b4de7ec64864f0..651f0a44cbeb6a16761f43129fef9a7fe38b6abd 100644 (file)
@@ -540,8 +540,8 @@ public:
       (std::is_same<typename std::decay<FEPairs>::type,
                     std::pair<std::unique_ptr<FiniteElement<dim, spacedim>>,
                               unsigned int>>::value ||
-       std::is_base_of<FiniteElement<dim, spacedim>,
-                       typename std::decay<FEPairs>::type>::value)...>>
+       std::is_base_of_v<FiniteElement<dim, spacedim>,
+                         typename std::decay<FEPairs>::type>)...>>
   FESystem(FEPairs &&...fe_pairs);
 
   /**
index acf83936e446427f25abed56e24007ecdc72b4e8..018c06b1bea19b7cbda68ab3aff4f4bd7157a53e 100644 (file)
@@ -238,10 +238,9 @@ public:
    * object @p op for which the conversion function
    * <code>linear_operator</code> is defined.
    */
-  template <
-    typename Op,
-    typename = std::enable_if_t<
-      !std::is_base_of<LinearOperator<Range, Domain, Payload>, Op>::value>>
+  template <typename Op,
+            typename = std::enable_if_t<
+              !std::is_base_of_v<LinearOperator<Range, Domain, Payload>, Op>>>
   LinearOperator(const Op &op)
   {
     *this = linear_operator<Range, Domain, Payload, Op>(op);
@@ -257,10 +256,9 @@ public:
    * Templated copy assignment operator for an object @p op for which the
    * conversion function <code>linear_operator</code> is defined.
    */
-  template <
-    typename Op,
-    typename = std::enable_if_t<
-      !std::is_base_of<LinearOperator<Range, Domain, Payload>, Op>::value>>
+  template <typename Op,
+            typename = std::enable_if_t<
+              !std::is_base_of_v<LinearOperator<Range, Domain, Payload>, Op>>>
   LinearOperator<Range, Domain, Payload> &
   operator=(const Op &op)
   {
index 2d6168c674e7cecfb0301d748164d3619178e3ec..793f89e7b54a6f676fce0d2d12ca0c52dbff372e 100644 (file)
@@ -2186,9 +2186,9 @@ namespace TrilinosWrappers
          */
         template <typename Solver, typename Preconditioner>
         std::enable_if_t<
-          std::is_base_of<TrilinosWrappers::SolverBase, Solver>::value &&
-            std::is_base_of<TrilinosWrappers::PreconditionBase,
-                            Preconditioner>::value,
+          std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
+            std::is_base_of_v<TrilinosWrappers::PreconditionBase,
+                              Preconditioner>,
           TrilinosPayload>
         inverse_payload(Solver &, const Preconditioner &) const;
 
@@ -2211,9 +2211,9 @@ namespace TrilinosWrappers
          */
         template <typename Solver, typename Preconditioner>
         std::enable_if_t<
-          !(std::is_base_of<TrilinosWrappers::SolverBase, Solver>::value &&
-            std::is_base_of<TrilinosWrappers::PreconditionBase,
-                            Preconditioner>::value),
+          !(std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
+            std::is_base_of_v<TrilinosWrappers::PreconditionBase,
+                              Preconditioner>),
           TrilinosPayload>
         inverse_payload(Solver &, const Preconditioner &) const;
 
@@ -3218,9 +3218,8 @@ namespace TrilinosWrappers
 
       template <typename Solver, typename Preconditioner>
       std::enable_if_t<
-        std::is_base_of<TrilinosWrappers::SolverBase, Solver>::value &&
-          std::is_base_of<TrilinosWrappers::PreconditionBase,
-                          Preconditioner>::value,
+        std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
+          std::is_base_of_v<TrilinosWrappers::PreconditionBase, Preconditioner>,
         TrilinosPayload>
       TrilinosPayload::inverse_payload(
         Solver &              solver,
@@ -3273,9 +3272,9 @@ namespace TrilinosWrappers
 
       template <typename Solver, typename Preconditioner>
       std::enable_if_t<
-        !(std::is_base_of<TrilinosWrappers::SolverBase, Solver>::value &&
-          std::is_base_of<TrilinosWrappers::PreconditionBase,
-                          Preconditioner>::value),
+        !(std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
+          std::is_base_of_v<TrilinosWrappers::PreconditionBase,
+                            Preconditioner>),
         TrilinosPayload>
       TrilinosPayload::inverse_payload(Solver &, const Preconditioner &) const
       {

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.