From 72841f0feed12af074c16480c4ce26fdbf3ec882 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 22 Jul 2023 20:44:32 -0600 Subject: [PATCH] Prefer std::remove_*_t over std::remove_*::type. --- include/deal.II/base/array_view.h | 41 +++++++++---------- include/deal.II/base/mutable_bind.h | 4 +- .../deal.II/matrix_free/evaluation_kernels.h | 5 +-- include/deal.II/matrix_free/fe_evaluation.h | 6 +-- include/deal.II/matrix_free/type_traits.h | 2 +- include/deal.II/sundials/n_vector.templates.h | 11 +++-- tests/base/array_view_08.cc | 3 +- tests/base/array_view_09.cc | 3 +- ...w_get_function_from_local_dof_values_01.cc | 16 ++++---- ...w_get_function_from_local_dof_values_02.cc | 16 ++++---- ...w_get_function_from_local_dof_values_01.cc | 8 ++-- ...w_get_function_from_local_dof_values_02.cc | 8 ++-- tests/matrix_free/poisson_dg_hp.cc | 3 +- tests/simplex/matrix_free_01.cc | 5 +-- tests/simplex/matrix_free_02.cc | 3 +- tests/simplex/matrix_free_03.cc | 3 +- tests/simplex/matrix_free_04.cc | 3 +- 17 files changed, 64 insertions(+), 76 deletions(-) diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 6728fefeec..f5fd75dc0e 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -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::type, - MemorySpaceType> &view); + ArrayView( + const ArrayView, 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 ArrayView@. */ - ArrayView( - const std::vector::type> &vector); + ArrayView(const std::vector> &vector); /** * A constructor that automatically creates a view from a std::vector object. @@ -176,7 +175,7 @@ public: * ArrayView@, or to non-@p const memory, * such as ArrayView@. */ - ArrayView(std::vector::type> &vector); + ArrayView(std::vector> &vector); /** * A constructor that automatically creates a view for a given C-style array. @@ -204,8 +203,7 @@ public: * a std::array. */ template - ArrayView( - const std::array::type, N> &vector); + ArrayView(const std::array, N> &vector); /** * A constructor that automatically creates a view from a std::array object. @@ -216,7 +214,7 @@ public: * a std::array. */ template - ArrayView(std::array::type, N> &vector); + ArrayView(std::array, N> &vector); /** * Reinitialize a view. @@ -271,8 +269,8 @@ public: * This version always compares with the non-const value_type. */ bool - operator==(const ArrayView::type, - MemorySpaceType> &other_view) const; + operator==(const ArrayView, 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::type, - MemorySpaceType> &other_view) const; + operator!=(const ArrayView, MemorySpaceType> + &other_view) const; /** * Return the size (in elements) of the view of memory this object @@ -429,8 +427,7 @@ inline ArrayView::ArrayView(ElementType &element) template inline ArrayView::ArrayView( - const ArrayView::type, MemorySpaceType> - &view) + const ArrayView, MemorySpaceType> &view) : starting_element(view.starting_element) , n_elements(view.n_elements) {} @@ -439,7 +436,7 @@ inline ArrayView::ArrayView( template inline ArrayView::ArrayView( - const std::vector::type> &vector) + const std::vector> &vector) : // use delegating constructor ArrayView(vector.data(), vector.size()) { @@ -463,7 +460,7 @@ inline ArrayView::ArrayView( template inline ArrayView::ArrayView( - std::vector::type> &vector) + std::vector> &vector) : // use delegating constructor ArrayView(vector.data(), vector.size()) {} @@ -473,7 +470,7 @@ inline ArrayView::ArrayView( template template inline ArrayView::ArrayView( - const std::array::type, N> &vector) + const std::array, N> &vector) : // use delegating constructor ArrayView(vector.data(), vector.size()) { @@ -507,7 +504,7 @@ inline ArrayView::ArrayView( template template inline ArrayView::ArrayView( - std::array::type, N> &vector) + std::array, N> &vector) : // use delegating constructor ArrayView(vector.data(), vector.size()) {} @@ -528,8 +525,8 @@ ArrayView::operator==( template inline bool ArrayView::operator==( - const ArrayView::type, MemorySpaceType> - &other_view) const + const ArrayView, 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 inline bool ArrayView::operator!=( - const ArrayView::type, MemorySpaceType> - &other_view) const + const ArrayView, MemorySpaceType> &other_view) + const { return !(*this == other_view); } diff --git a/include/deal.II/base/mutable_bind.h b/include/deal.II/base/mutable_bind.h index ea0f024f93..baabdcf570 100644 --- a/include/deal.II/base/mutable_bind.h +++ b/include/deal.II/base/mutable_bind.h @@ -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::type>::type...>; + using TupleType = + std::tuple>...>; /** * Construct a MutableBind object specifying the function, and diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 664f5d15e1..7e15b5f6ba 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -2279,9 +2279,8 @@ namespace internal { // `OtherNumber` is either `const Number` (evaluate()) or `Number` // (integrate()) - static_assert( - std::is_same_v::type>, - "Type of Number and of OtherNumber do not match."); + static_assert(std::is_same_v>, + "Type of Number and of OtherNumber do not match."); const auto element_type = fe_eval.get_shape_info().element_type; using ElementType = MatrixFreeFunctions::ElementType; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 617670e347..225c777f66 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -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::type, - IsBlockVector::type>::value>:: - BaseVectorType *>(src_data.first[d]), + std::remove_const_t, + IsBlockVector>::value>::BaseVectorType + *>(src_data.first[d]), is_valid_mode_for_sm, active_fe_index, dof_info); diff --git a/include/deal.II/matrix_free/type_traits.h b/include/deal.II/matrix_free/type_traits.h index c65c601b7f..bfdfb35365 100644 --- a/include/deal.II/matrix_free/type_traits.h +++ b/include/deal.II/matrix_free/type_traits.h @@ -116,7 +116,7 @@ namespace internal static const bool value = has_begin && (has_local_element || - is_serial_vector::type>::value) && + is_serial_vector>::value) && std::is_same_v; }; diff --git a/include/deal.II/sundials/n_vector.templates.h b/include/deal.II/sundials/n_vector.templates.h index 6f8e7dd791..7035cf5343 100644 --- a/include/deal.II/sundials/n_vector.templates.h +++ b/include/deal.II/sundials/n_vector.templates.h @@ -473,14 +473,13 @@ namespace SUNDIALS # endif ) : vector_ptr( - create_nvector( - new NVectorContent::type>( - &vector) + create_nvector(new NVectorContent>( + &vector) # if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0) - , - nvector_context + , + nvector_context # endif - ), + ), [](N_Vector v) { N_VDestroy(v); }) {} diff --git a/tests/base/array_view_08.cc b/tests/base/array_view_08.cc index 15d5f72a44..24370c30f9 100644 --- a/tests/base/array_view_08.cc +++ b/tests/base/array_view_08.cc @@ -26,8 +26,7 @@ template constexpr bool is_const_reference() { - return std::is_reference_v && - std::is_const_v::type>; + return std::is_reference_v && std::is_const_v>; } void diff --git a/tests/base/array_view_09.cc b/tests/base/array_view_09.cc index a1daab5d20..8764157f63 100644 --- a/tests/base/array_view_09.cc +++ b/tests/base/array_view_09.cc @@ -28,8 +28,7 @@ template constexpr bool is_const_reference() { - return std::is_reference_v && - std::is_const_v::type>; + return std::is_reference_v && std::is_const_v>; } void diff --git a/tests/fe/fe_values_view_get_function_from_local_dof_values_01.cc b/tests/fe/fe_values_view_get_function_from_local_dof_values_01.cc index 6adbb62535..dbdacb2fe4 100644 --- a/tests/fe/fe_values_view_get_function_from_local_dof_values_01.cc +++ b/tests/fe/fe_values_view_get_function_from_local_dof_values_01.cc @@ -54,8 +54,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Scalar &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View & fe_values_view = fe_values[extractor]; const NumberType tolerance = std::is_same_v ? 1e-5 : 1e-13; @@ -148,8 +148,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Vector &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View & fe_values_view = fe_values[extractor]; const NumberType tolerance = std::is_same_v ? 1e-5 : 1e-13; @@ -290,8 +290,8 @@ test_view(const Vector & solution, const FEValuesExtractors::SymmetricTensor<2> &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View & fe_values_view = fe_values[extractor]; const NumberType tolerance = std::is_same_v ? 1e-5 : 1e-13; @@ -339,8 +339,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Tensor<2> &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View &fe_values_view = fe_values[extractor]; // Typedefs diff --git a/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc b/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc index d39483ff55..07930f87c9 100644 --- a/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc +++ b/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc @@ -60,8 +60,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Scalar &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View &fe_values_view = fe_values[extractor]; // Typedefs @@ -106,8 +106,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Vector &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View &fe_values_view = fe_values[extractor]; // Typedefs @@ -171,8 +171,8 @@ test_view(const Vector & solution, const FEValuesExtractors::SymmetricTensor<2> &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View &fe_values_view = fe_values[extractor]; // Typedefs @@ -203,8 +203,8 @@ test_view(const Vector & solution, const FEValuesExtractors::Tensor<2> &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = std::remove_reference_t< + std::remove_const_t>; const View &fe_values_view = fe_values[extractor]; // Typedefs diff --git a/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_01.cc b/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_01.cc index 21316bfd54..502790a456 100644 --- a/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_01.cc +++ b/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_01.cc @@ -55,8 +55,8 @@ test_feiv_view(const Vector & solution, const FEValuesExtractors::Scalar &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = + std::remove_reference_t>; const View &fe_iv_view = fe_iv[extractor]; // Typedefs @@ -176,8 +176,8 @@ test_feiv_view(const Vector & solution, const FEValuesExtractors::Vector &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = + std::remove_reference_t>; const View &fe_iv_view = fe_iv[extractor]; // Typedefs diff --git a/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_02.cc b/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_02.cc index d54d01389b..c9915d3444 100644 --- a/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_02.cc +++ b/tests/feinterface/fe_interface_view_get_function_from_local_dof_values_02.cc @@ -63,8 +63,8 @@ test_feiv_view(const Vector & solution, const FEValuesExtractors::Scalar &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = + std::remove_reference_t>; const View &fe_iv_view = fe_iv[extractor]; // Typedefs @@ -137,8 +137,8 @@ test_feiv_view(const Vector & solution, const FEValuesExtractors::Vector &extractor, const std::vector & local_dof_values) { - using View = typename std::remove_reference< - typename std::remove_const::type>::type; + using View = + std::remove_reference_t>; const View &fe_iv_view = fe_iv[extractor]; // Typedefs diff --git a/tests/matrix_free/poisson_dg_hp.cc b/tests/matrix_free/poisson_dg_hp.cc index f2e45cb7aa..baa2a10a9e 100644 --- a/tests/matrix_free/poisson_dg_hp.cc +++ b/tests/matrix_free/poisson_dg_hp.cc @@ -268,8 +268,7 @@ test(const unsigned int degree) auto & x, auto & b) -> std::pair { ReductionControl reduction_control(2000, 1e-7, 1e-2); - SolverCG::type> solver( - reduction_control); + SolverCG> solver(reduction_control); solver.solve(poisson_operator, x, b, PreconditionIdentity()); diff --git a/tests/simplex/matrix_free_01.cc b/tests/simplex/matrix_free_01.cc index 37771aeed6..99f5a1c5e5 100644 --- a/tests/simplex/matrix_free_01.cc +++ b/tests/simplex/matrix_free_01.cc @@ -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 { - ReductionControl reduction_control; - SolverCG::type> solver( - reduction_control); + ReductionControl reduction_control; + SolverCG> solver(reduction_control); solver.solve(poisson_operator, x, b, PreconditionIdentity()); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) diff --git a/tests/simplex/matrix_free_02.cc b/tests/simplex/matrix_free_02.cc index ed29a62f82..04de2de173 100644 --- a/tests/simplex/matrix_free_02.cc +++ b/tests/simplex/matrix_free_02.cc @@ -181,8 +181,7 @@ test(const unsigned version, const unsigned int degree, const bool do_helmholtz) auto & x, auto & b) -> std::tuple { ReductionControl reduction_control(1000, 1e-10, 1e-4); - SolverCG::type> solver( - reduction_control); + SolverCG> solver(reduction_control); solver.solve(poisson_operator, x, b, PreconditionIdentity()); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) diff --git a/tests/simplex/matrix_free_03.cc b/tests/simplex/matrix_free_03.cc index 57d3adbb6f..0c2df1500f 100644 --- a/tests/simplex/matrix_free_03.cc +++ b/tests/simplex/matrix_free_03.cc @@ -327,8 +327,7 @@ test(const unsigned int degree) auto & x, auto & b) -> std::pair { ReductionControl reduction_control(1000, 1e-7, 1e-3); - SolverCG::type> solver( - reduction_control); + SolverCG> solver(reduction_control); try { diff --git a/tests/simplex/matrix_free_04.cc b/tests/simplex/matrix_free_04.cc index 4d95f9a677..4e4f275554 100644 --- a/tests/simplex/matrix_free_04.cc +++ b/tests/simplex/matrix_free_04.cc @@ -278,8 +278,7 @@ test(const unsigned version, const unsigned int degree) auto & x, auto & b) -> std::pair { ReductionControl reduction_control(2000, 1e-7, 1e-2); - SolverCG::type> solver( - reduction_control); + SolverCG> solver(reduction_control); solver.solve(poisson_operator, x, b, PreconditionIdentity()); -- 2.39.5