From: Wolfgang Bangerth Date: Fri, 14 Jul 2023 18:37:26 +0000 (-0600) Subject: Prefer std::is_base_of_v over std::is_base_of::value. X-Git-Tag: relicensing~674^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f4b40d5f840dd7f90a8de010932b07c5ce0c8dc;p=dealii.git Prefer std::is_base_of_v over std::is_base_of::value. --- diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index a23c23c3b1..2498abd35c 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1482,7 +1482,7 @@ namespace deal_II_exceptions const char * exc_name, ExceptionType e) noexcept { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "The provided exception must inherit from ExceptionBase."); // Fill the fields of the exception object e.set_fields(file, line, function, cond, exc_name); diff --git a/include/deal.II/base/function_lib.h b/include/deal.II/base/function_lib.h index fcd843efbd..bf3e239ec2 100644 --- a/include/deal.II/base/function_lib.h +++ b/include/deal.II/base/function_lib.h @@ -1764,7 +1764,7 @@ namespace Functions { initialized = true; static_assert( - std::is_base_of, CutOffFunctionBaseType<1>>::value, + std::is_base_of_v, CutOffFunctionBaseType<1>>, "You can only construct a CutOffFunctionTensorProduct function from " "a class derived from CutOffFunctionBase."); diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index 5dabd69336..ca622cac12 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -440,7 +440,7 @@ namespace parallel { public: static_assert( - std::is_base_of::value, + std::is_base_of_v, "User's DataType class should be derived from TransferableQuadraturePointData"); /** @@ -604,7 +604,7 @@ CellDataStorage::initialize( const CellIteratorType &cell, const unsigned int n_q_points) { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "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> CellDataStorage::get_data( const CellIteratorType &cell) { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "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> CellDataStorage::get_data( const CellIteratorType &cell) const { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "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>> CellDataStorage::try_get_data( const CellIteratorType &cell) { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "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>> CellDataStorage::try_get_data( const CellIteratorType &cell) const { - static_assert(std::is_base_of::value, + static_assert(std::is_base_of_v, "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 *data_storage, FullMatrix & matrix_data) { - static_assert( - std::is_base_of::value, - "User's DataType class should be derived from QPData"); + static_assert(std::is_base_of_v, + "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 & values_at_qp, CellDataStorage *data_storage) { - static_assert( - std::is_base_of::value, - "User's DataType class should be derived from QPData"); + static_assert(std::is_base_of_v, + "User's DataType class should be derived from QPData"); if (const auto qpd = data_storage->try_get_data(cell)) { diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 8767b30c96..9255d41f94 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -202,7 +202,7 @@ template struct is_base_of_all { static constexpr bool value = internal::TemplateConstraints::all_true< - std::is_base_of::value...>::value; + std::is_base_of_v...>::value; }; diff --git a/include/deal.II/differentiation/sd/symengine_scalar_operations.h b/include/deal.II/differentiation/sd/symengine_scalar_operations.h index 149902706c..d4edade89f 100644 --- a/include/deal.II/differentiation/sd/symengine_scalar_operations.h +++ b/include/deal.II/differentiation/sd/symengine_scalar_operations.h @@ -304,7 +304,7 @@ namespace Differentiation typename ValueType = double, typename SymbolicType, typename T = std::enable_if_t< - !std::is_base_of::value && + !std::is_base_of_v && dealii::internal::is_explicitly_convertible< SymbolicType, const SymEngine::RCP &>::value>> diff --git a/include/deal.II/fe/fe_system.h b/include/deal.II/fe/fe_system.h index ee5da98378..651f0a44cb 100644 --- a/include/deal.II/fe/fe_system.h +++ b/include/deal.II/fe/fe_system.h @@ -540,8 +540,8 @@ public: (std::is_same::type, std::pair>, unsigned int>>::value || - std::is_base_of, - typename std::decay::type>::value)...>> + std::is_base_of_v, + typename std::decay::type>)...>> FESystem(FEPairs &&...fe_pairs); /** diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index acf83936e4..018c06b1be 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -238,10 +238,9 @@ public: * object @p op for which the conversion function * linear_operator is defined. */ - template < - typename Op, - typename = std::enable_if_t< - !std::is_base_of, Op>::value>> + template , Op>>> LinearOperator(const Op &op) { *this = linear_operator(op); @@ -257,10 +256,9 @@ public: * Templated copy assignment operator for an object @p op for which the * conversion function linear_operator is defined. */ - template < - typename Op, - typename = std::enable_if_t< - !std::is_base_of, Op>::value>> + template , Op>>> LinearOperator & operator=(const Op &op) { diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 2d6168c674..793f89e7b5 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2186,9 +2186,9 @@ namespace TrilinosWrappers */ template std::enable_if_t< - std::is_base_of::value && - std::is_base_of::value, + std::is_base_of_v && + std::is_base_of_v, TrilinosPayload> inverse_payload(Solver &, const Preconditioner &) const; @@ -2211,9 +2211,9 @@ namespace TrilinosWrappers */ template std::enable_if_t< - !(std::is_base_of::value && - std::is_base_of::value), + !(std::is_base_of_v && + std::is_base_of_v), TrilinosPayload> inverse_payload(Solver &, const Preconditioner &) const; @@ -3218,9 +3218,8 @@ namespace TrilinosWrappers template std::enable_if_t< - std::is_base_of::value && - std::is_base_of::value, + std::is_base_of_v && + std::is_base_of_v, TrilinosPayload> TrilinosPayload::inverse_payload( Solver & solver, @@ -3273,9 +3272,9 @@ namespace TrilinosWrappers template std::enable_if_t< - !(std::is_base_of::value && - std::is_base_of::value), + !(std::is_base_of_v && + std::is_base_of_v), TrilinosPayload> TrilinosPayload::inverse_payload(Solver &, const Preconditioner &) const {