From: Wolfgang Bangerth Date: Wed, 19 Jul 2023 17:34:26 +0000 (-0600) Subject: Prefer std::is_*_v over std::is_*::value. X-Git-Tag: relicensing~661^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15766%2Fhead;p=dealii.git Prefer std::is_*_v over std::is_*::value. --- diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 04067ff708..76f11f8960 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -762,7 +762,7 @@ namespace internal // (void*) to silence compiler warning for virtual classes (they will // never arrive here because they are non-trivial). - if (std::is_trivial::value == true) + if (std::is_trivial_v == true) std::memcpy(static_cast(destination_ + begin), static_cast(source_ + begin), (end - begin) * sizeof(T)); @@ -830,7 +830,7 @@ namespace internal // Classes with trivial assignment can use memcpy. cast element to // (void*) to silence compiler warning for virtual classes (they will // never arrive here because they are non-trivial). - if (std::is_trivial::value == true) + if (std::is_trivial_v == true) std::memcpy(static_cast(destination_ + begin), static_cast(source_ + begin), (end - begin) * sizeof(T)); @@ -889,7 +889,7 @@ namespace internal // do not use memcmp for long double because on some systems it does not // completely fill its memory and may lead to false positives in // e.g. valgrind - if (std::is_trivial::value == true && + if (std::is_trivial_v == true && std::is_same_v == false) { const unsigned char zero[sizeof(T)] = {}; @@ -918,7 +918,7 @@ namespace internal // element to (void*) to silence compiler warning for virtual // classes (they will never arrive here because they are // non-trivial). - if (std::is_trivial::value == true && trivial_element) + if (std::is_trivial_v == true && trivial_element) std::memset(static_cast(destination_ + begin), 0, (end - begin) * sizeof(T)); @@ -1003,7 +1003,7 @@ namespace internal // element to (void*) to silence compiler warning for virtual // classes (they will never arrive here because they are // non-trivial). - if (std::is_trivial::value == true) + if (std::is_trivial_v == true) std::memset(static_cast(destination_ + begin), 0, (end - begin) * sizeof(T)); @@ -1081,7 +1081,7 @@ AlignedVector::Deleter::operator()(T *ptr) Assert(owning_aligned_vector->used_elements_end != nullptr, ExcInternalError()); - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) for (T *p = owning_aligned_vector->used_elements_end - 1; p >= ptr; --p) p->~T(); @@ -1138,7 +1138,7 @@ AlignedVector::Deleter::MPISharedMemDeleterAction::delete_array( // it, not unique_ptr) so it is still set to its correct value. if (is_shmem_root) - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) for (T *p = aligned_vector->used_elements_end - 1; p >= ptr; --p) p->~T(); @@ -1266,7 +1266,7 @@ AlignedVector::resize_fast(const size_type new_size) // call destructor on fields that are released, if the type requires it. // doing it backward releases the elements in reverse order as compared to // how they were created - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p) p->~T(); used_elements_end = elements.get() + new_size; @@ -1279,7 +1279,7 @@ AlignedVector::resize_fast(const size_type new_size) // need to still set the values in case the class is non-trivial because // virtual classes etc. need to run their (default) constructor - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) dealii::internal::AlignedVectorDefaultInitialize( new_size - old_size, elements.get() + old_size); } @@ -1302,7 +1302,7 @@ AlignedVector::resize(const size_type new_size) // call destructor on fields that are released, if the type requires it. // doing it backward releases the elements in reverse order as compared to // how they were created - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p) p->~T(); used_elements_end = elements.get() + new_size; @@ -1336,7 +1336,7 @@ AlignedVector::resize(const size_type new_size, const T &init) // call destructor on fields that are released, if the type requires it. // doing it backward releases the elements in reverse order as compared to // how they were created - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) for (T *p = used_elements_end - 1; p >= elements.get() + new_size; --p) p->~T(); used_elements_end = elements.get() + new_size; @@ -1433,7 +1433,7 @@ AlignedVector::push_back(const T in_data) Assert(used_elements_end <= allocated_elements_end, ExcInternalError()); if (used_elements_end == allocated_elements_end) reserve(std::max(2 * capacity(), static_cast(16))); - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) new (used_elements_end++) T(in_data); else *used_elements_end++ = in_data; @@ -1472,7 +1472,7 @@ AlignedVector::insert_back(ForwardIterator begin, ForwardIterator end) reserve(old_size + (end - begin)); for (; begin != end; ++begin, ++used_elements_end) { - if (std::is_trivial::value == false) + if (std::is_trivial_v == false) new (used_elements_end) T; *used_elements_end = *begin; } @@ -1633,7 +1633,7 @@ AlignedVector::replicate_across_communicator(const MPI_Comm communicator, // has all of the data. if (is_shmem_root) { - if (std::is_trivial::value) + if (std::is_trivial_v) { // The data is "trivial", i.e., we can copy things directly without // having to go through the serialization/deserialization machinery of @@ -1826,7 +1826,7 @@ AlignedVector::replicate_across_communicator(const MPI_Comm communicator, // shared memory space. if (is_shmem_root) { - if (std::is_trivial::value == true) + if (std::is_trivial_v == true) std::memcpy(aligned_shmem_pointer, elements.get(), sizeof(T) * size()); else for (std::size_t i = 0; i < size(); ++i) diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 6f4d8922c1..6728fefeec 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -452,7 +452,7 @@ inline ArrayView::ArrayView( // nevertheless, leave the static_assert in since it provides a // more descriptive error message that will simply come after the first // error produced above - static_assert(std::is_const::value == true, + static_assert(std::is_const_v == true, "This constructor may only be called if the ArrayView " "object has a const value_type. In other words, you can " "only create an ArrayView to const values from a const " @@ -486,7 +486,7 @@ inline ArrayView::ArrayView( // nevertheless, leave the static_assert in since it provides a // more descriptive error message that will simply come after the first // error produced above - static_assert(std::is_const::value == true, + static_assert(std::is_const_v == true, "This constructor may only be called if the ArrayView " "object has a const value_type. In other words, you can " "only create an ArrayView to const values from a const " diff --git a/include/deal.II/base/linear_index_iterator.h b/include/deal.II/base/linear_index_iterator.h index 9894774680..e9d0d2cb6b 100644 --- a/include/deal.II/base/linear_index_iterator.h +++ b/include/deal.II/base/linear_index_iterator.h @@ -254,8 +254,7 @@ public: * the same entry in the same container. */ template - std::enable_if_t::value, - bool> + std::enable_if_t, bool> operator==(const OtherIterator &right) const { const auto &right_2 = static_cast(right); @@ -266,8 +265,7 @@ public: * Opposite of operator==(). */ template - std::enable_if_t::value, - bool> + std::enable_if_t, bool> operator!=(const OtherIterator &right) const { return !(*this == right); diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index d55b6348e4..e37784d155 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -89,7 +89,7 @@ namespace MemoryConsumption * implemented. */ template - inline std::enable_if_t::value, std::size_t> + inline std::enable_if_t, std::size_t> memory_consumption(const T &t); /** @@ -99,8 +99,7 @@ namespace MemoryConsumption * t.memory_consumption()'s value. */ template - inline std::enable_if_t::value || - std::is_pointer::value), + inline std::enable_if_t || std::is_pointer_v), std::size_t> memory_consumption(const T &t); @@ -260,7 +259,7 @@ namespace MemoryConsumption namespace MemoryConsumption { template - inline std::enable_if_t::value, std::size_t> + inline std::enable_if_t, std::size_t> memory_consumption(const T &) { return sizeof(T); @@ -314,7 +313,7 @@ namespace MemoryConsumption memory_consumption(const std::vector &v) { // shortcut for types that do not allocate memory themselves - if (std::is_fundamental::value || std::is_pointer::value) + if (std::is_fundamental_v || std::is_pointer_v) { return v.capacity() * sizeof(T) + sizeof(v); } @@ -337,7 +336,7 @@ namespace MemoryConsumption memory_consumption(const std::array &v) { // shortcut for types that do not allocate memory themselves - if (std::is_fundamental::value || std::is_pointer::value) + if (std::is_fundamental_v || std::is_pointer_v) { return sizeof(v); } @@ -409,8 +408,7 @@ namespace MemoryConsumption template - inline std::enable_if_t::value || - std::is_pointer::value), + inline std::enable_if_t || std::is_pointer_v), std::size_t> memory_consumption(const T &t) { diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index 5322eb144c..8212fb5492 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -1844,7 +1844,7 @@ namespace Utilities const MPI_Comm mpi_communicator, T (&results)[N]) { - static_assert(std::is_integral::value, + static_assert(std::is_integral_v, "The MPI_LOR operation only allows integral data types."); internal::all_reduce(MPI_LOR, diff --git a/include/deal.II/base/mpi.templates.h b/include/deal.II/base/mpi.templates.h index 3f6b8815d5..1f260f4960 100644 --- a/include/deal.II/base/mpi.templates.h +++ b/include/deal.II/base/mpi.templates.h @@ -339,7 +339,7 @@ namespace Utilities T logical_or(const T &t, const MPI_Comm mpi_communicator) { - static_assert(std::is_integral::value, + static_assert(std::is_integral_v, "The MPI_LOR operation only allows integral data types."); T return_value{}; @@ -359,7 +359,7 @@ namespace Utilities static_assert(std::is_same_v, std::decay_t>, "Input and output arguments must have the same type!"); - static_assert(std::is_integral::value, + static_assert(std::is_integral_v, "The MPI_LOR operation only allows integral data types."); // Specializations of std containers for the data type bool do not @@ -386,7 +386,7 @@ namespace Utilities const MPI_Comm mpi_communicator, const ArrayView & results) { - static_assert(std::is_integral::value, + static_assert(std::is_integral_v, "The MPI_LOR operation only allows integral data types."); internal::all_reduce(MPI_LOR, values, mpi_communicator, results); diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 1c9dd9606d..12b7973592 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -716,7 +716,7 @@ namespace internal static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, std::enable_if_t, std::decay_t> && - std::is_constructible::value> * = nullptr) + std::is_constructible_v> * = nullptr) { return T(f); } @@ -726,7 +726,7 @@ namespace internal static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, std::enable_if_t, std::decay_t> && - !std::is_constructible::value && + !std::is_constructible_v && is_explicitly_convertible::value> * = nullptr) { @@ -742,7 +742,7 @@ namespace internal value( const F &f, std::enable_if_t, std::decay_t> && - !std::is_constructible::value && + !std::is_constructible_v && !is_explicitly_convertible::value && Differentiation::AD::is_ad_number::value> * = nullptr) { diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index fa4cf1c05b..6121527c45 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -2339,7 +2339,7 @@ ParameterHandler::add_parameter(const std::string & entry, const Patterns::PatternBase &pattern, const bool has_to_be_set) { - static_assert(std::is_const::value == false, + static_assert(std::is_const_v == false, "You tried to add a parameter using a type " "that is const. Use a non-const type."); diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 8f6b4086d1..978a6c4089 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -473,7 +473,7 @@ namespace Utilities // standards. To avoid this, we use std::abs on default types but // simply return the number on unsigned types template - std::enable_if_t::value, + std::enable_if_t, typename numbers::NumberTraits::real_type> get_abs(const Number a) { @@ -481,7 +481,7 @@ namespace Utilities } template - std::enable_if_t::value, Number> + std::enable_if_t, Number> get_abs(const Number a) { return a; @@ -783,7 +783,7 @@ namespace Utilities else # endif { - if constexpr (std::is_trivial::value) + if constexpr (std::is_trivial_v) { std::memset(ghost_array.data(), 0, diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index e0d71fad93..96daf28834 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1481,7 +1481,7 @@ namespace Patterns // Arithmetic types template - struct Convert::value>> + struct Convert>> { template static std::enable_if_t && @@ -1495,7 +1495,7 @@ namespace Patterns template static std::enable_if_t && !std::is_same_v && - std::is_integral::value, + std::is_integral_v, std::unique_ptr> to_pattern() { @@ -1506,7 +1506,7 @@ namespace Patterns template static std::enable_if_t && !std::is_same_v && - std::is_floating_point::value, + std::is_floating_point_v, std::unique_ptr> to_pattern() { diff --git a/include/deal.II/base/table_indices.h b/include/deal.II/base/table_indices.h index a686002ad1..9fedf17c6b 100644 --- a/include/deal.II/base/table_indices.h +++ b/include/deal.II/base/table_indices.h @@ -122,9 +122,9 @@ template constexpr TableIndices::TableIndices(const T... args) : indices{static_cast(args)...} { - static_assert(internal::TemplateConstraints::all_true< - std::is_integral::value...>::value, - "Not all of the parameters have integral type!"); + static_assert( + internal::TemplateConstraints::all_true...>::value, + "Not all of the parameters have integral type!"); static_assert(sizeof...(T) == N, "Wrong number of constructor arguments!"); } diff --git a/include/deal.II/base/thread_local_storage.h b/include/deal.II/base/thread_local_storage.h index 05f637ee56..909aa7441e 100644 --- a/include/deal.II/base/thread_local_storage.h +++ b/include/deal.II/base/thread_local_storage.h @@ -106,7 +106,7 @@ namespace Threads static_assert( std::is_copy_constructible< typename internal::unpack_container::type>::value || - std::is_default_constructible::value, + std::is_default_constructible_v, "The stored type must be either copyable, or default constructible"); public: @@ -373,7 +373,7 @@ namespace Threads */ template std::enable_if_t< - std::is_copy_constructible::type>::value, + std::is_copy_constructible_v::type>, T &> construct_element(std::map & data, const std::thread::id & id, @@ -389,7 +389,7 @@ namespace Threads template std::enable_if_t< - !std::is_copy_constructible::type>::value, + !std::is_copy_constructible_v::type>, T &> construct_element(std::map &data, const std::thread::id & id, diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index b0f0317d51..348599d9eb 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -498,7 +498,7 @@ namespace Utilities // return prefactor * dealii::Utilities::pow(base*base, iexp/2); // - static_assert(std::is_integral::value, "Only integral types supported"); + static_assert(std::is_integral_v, "Only integral types supported"); return iexp <= 0 ? 1 : @@ -982,8 +982,8 @@ namespace Utilities inline T fixed_power(const T x) { - Assert(((std::is_integral::value == true) && (N >= 0)) || - (std::is_integral::value == false), + Assert(((std::is_integral_v == true) && (N >= 0)) || + (std::is_integral_v == false), ExcMessage("If the type of the argument, T, is an integer type, " "then the exponent N must be a non-negative integer " "because the result would otherwise not be an integer.")); @@ -1123,7 +1123,7 @@ namespace Utilities /** * A structure that is used to identify whether a template argument is a * std::vector or std::vector> where T is a type that - * satisfies std::is_trivially_copyable::value == true. + * satisfies std::is_trivially_copyable_v == true. */ template struct IsVectorOfTriviallyCopyable @@ -1137,7 +1137,7 @@ namespace Utilities struct IsVectorOfTriviallyCopyable> { static constexpr bool value = - std::is_trivially_copyable::value && !std::is_same_v; + std::is_trivially_copyable_v && !std::is_same_v; }; @@ -1146,14 +1146,14 @@ namespace Utilities struct IsVectorOfTriviallyCopyable>> { static constexpr bool value = - std::is_trivially_copyable::value && !std::is_same_v; + std::is_trivially_copyable_v && !std::is_same_v; }; /** * A function that is used to append the contents of a std::vector - * (where T is a type that satisfies std::is_trivially_copyable::value + * (where T is a type that satisfies std::is_trivially_copyable_v * == true but not T==bool) bit for bit to a character array. * * If the type is not such a vector of T, then the function @@ -1172,7 +1172,7 @@ namespace Utilities template && - std::is_trivially_copyable::value>> + std::is_trivially_copyable_v>> inline void append_vector_of_trivially_copyable_to_buffer( const std::vector &object, @@ -1202,7 +1202,7 @@ namespace Utilities template && - std::is_trivially_copyable::value>> + std::is_trivially_copyable_v>> inline void append_vector_of_trivially_copyable_to_buffer( const std::vector> &object, @@ -1262,7 +1262,7 @@ namespace Utilities template && - std::is_trivially_copyable::value>> + std::is_trivially_copyable_v>> inline void create_vector_of_trivially_copyable_from_buffer( const std::vector::const_iterator &cbegin, @@ -1297,7 +1297,7 @@ namespace Utilities template && - std::is_trivially_copyable::value>> + std::is_trivially_copyable_v>> inline void create_vector_of_trivially_copyable_from_buffer( const std::vector::const_iterator &cbegin, diff --git a/include/deal.II/cgal/triangulation.h b/include/deal.II/cgal/triangulation.h index 4a21a41489..b68799c7ea 100644 --- a/include/deal.II/cgal/triangulation.h +++ b/include/deal.II/cgal/triangulation.h @@ -260,7 +260,7 @@ namespace CGALWrappers // Do the same with surface patches, if possible SubCellData subcell_data; - if constexpr (std::is_integral::value) + if constexpr (std::is_integral_v) { for (auto face = cgal_triangulation.facets_in_complex_begin(); face != cgal_triangulation.facets_in_complex_end(); @@ -283,7 +283,7 @@ namespace CGALWrappers } } // and curves - if constexpr (std::is_integral::value) + if constexpr (std::is_integral_v) { for (auto edge = cgal_triangulation.edges_in_complex_begin(); edge != cgal_triangulation.edges_in_complex_end(); diff --git a/include/deal.II/differentiation/sd/symengine_number_types.h b/include/deal.II/differentiation/sd/symengine_number_types.h index 3d57659e20..3e536fb5bf 100644 --- a/include/deal.II/differentiation/sd/symengine_number_types.h +++ b/include/deal.II/differentiation/sd/symengine_number_types.h @@ -203,9 +203,8 @@ namespace Differentiation * potential ambiguities related to implicit conversions in either user * code or math functions that are loaded into the standard namespace. */ - template < - typename NumberType, - typename = std::enable_if_t::value>> + template >> explicit Expression(const NumberType &value); /** @@ -215,9 +214,8 @@ namespace Differentiation * potential ambiguities related to implicit conversions in either user * code or math functions that are loaded into the standard namespace. */ - template < - typename NumberType, - typename = std::enable_if_t::value>> + template >> explicit Expression(const std::complex &value); /** @@ -231,9 +229,8 @@ namespace Differentiation * It is expected that both the @p numerator and @p denominator * be integral types. */ - template < - typename NumberType, - typename = std::enable_if_t::value>> + template >> Expression(const NumberType &numerator, const NumberType &denominator); /** @@ -1085,7 +1082,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator+(const NumberType &lhs, const Expression &rhs) { @@ -1102,7 +1099,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator+(const Expression &lhs, const NumberType &rhs) { @@ -1119,7 +1116,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator-(const NumberType &lhs, const Expression &rhs) { @@ -1136,7 +1133,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator-(const Expression &lhs, const NumberType &rhs) { @@ -1153,7 +1150,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator*(const NumberType &lhs, const Expression &rhs) { @@ -1170,7 +1167,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator*(const Expression &lhs, const NumberType &rhs) { @@ -1187,7 +1184,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator/(const NumberType &lhs, const Expression &rhs) { @@ -1204,7 +1201,7 @@ namespace Differentiation */ template ::value>> + std::is_constructible_v>> inline Expression operator/(const Expression &lhs, const NumberType &rhs) { @@ -1376,24 +1373,21 @@ namespace internal return t; } - template ::value>> + template >> static Differentiation::SD::Expression value(const T &t) { return Differentiation::SD::Expression(t); } - template ::value>> + template >> static Differentiation::SD::Expression value(T &&t) { return Differentiation::SD::Expression(t); } - template ::value>> + template >> static Differentiation::SD::Expression value(const std::complex &t) { diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index 20b2040a70..bbd8ff31ef 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -368,7 +368,7 @@ namespace Differentiation template struct SupportedOptimizerTypeTraits< ReturnType_, - std::enable_if_t::value>> + std::enable_if_t>> { static const bool is_supported = true; @@ -384,7 +384,7 @@ namespace Differentiation ReturnType_, std::enable_if_t< boost::is_complex::value && - std::is_arithmetic::value>> + std::is_arithmetic_v>> { static const bool is_supported = true; @@ -595,9 +595,8 @@ namespace Differentiation # ifdef HAVE_SYMENGINE_LLVM template - struct LLVMOptimizer< - ReturnType_, - std::enable_if_t::value>> + struct LLVMOptimizer>> { using ReturnType = typename std:: conditional, float, double>::type; @@ -711,7 +710,7 @@ namespace Differentiation ReturnType_, std::enable_if_t< boost::is_complex::value && - std::is_arithmetic::value>> + std::is_arithmetic_v>> { // Since there is no working implementation, these are dummy types // that help with templating in the calling function. diff --git a/include/deal.II/differentiation/sd/symengine_product_types.h b/include/deal.II/differentiation/sd/symengine_product_types.h index f12fa19622..5161fd41f0 100644 --- a/include/deal.II/differentiation/sd/symengine_product_types.h +++ b/include/deal.II/differentiation/sd/symengine_product_types.h @@ -64,10 +64,9 @@ namespace internal struct GeneralProductTypeImpl; template - struct GeneralProductTypeImpl< - T, - Differentiation::SD::Expression, - std::enable_if_t::value>> + struct GeneralProductTypeImpl>> { using type = Differentiation::SD::Expression; }; @@ -77,7 +76,7 @@ namespace internal T, Differentiation::SD::Expression, std::enable_if_t::value && - std::is_arithmetic::value>> + std::is_arithmetic_v>> { using type = Differentiation::SD::Expression; }; diff --git a/include/deal.II/differentiation/sd/symengine_scalar_operations.h b/include/deal.II/differentiation/sd/symengine_scalar_operations.h index d4edade89f..4c114021cb 100644 --- a/include/deal.II/differentiation/sd/symengine_scalar_operations.h +++ b/include/deal.II/differentiation/sd/symengine_scalar_operations.h @@ -464,7 +464,7 @@ namespace Differentiation dealii::internal::is_explicitly_convertible< SymbolicType, const SymEngine::RCP &>::value && - std::is_constructible::value>> + std::is_constructible_v>> void set_value_in_symbol_map(types::substitution_map &substitution_map, const SymbolicType & symbol, @@ -653,7 +653,7 @@ namespace Differentiation dealii::internal::is_explicitly_convertible< ExpressionType, const SymEngine::RCP &>::value && - std::is_constructible::value>> + std::is_constructible_v>> types::substitution_map make_substitution_map(const ExpressionType &symbol, const ValueType &value); @@ -896,7 +896,7 @@ namespace Differentiation dealii::internal::is_explicitly_convertible< ExpressionType, const SymEngine::RCP &>::value && - std::is_constructible::value>> + std::is_constructible_v>> void add_to_substitution_map(types::substitution_map &substitution_map, const ExpressionType & symbol, @@ -942,7 +942,7 @@ namespace Differentiation dealii::internal::is_explicitly_convertible< ExpressionType, const SymEngine::RCP &>::value && - std::is_constructible::value>> + std::is_constructible_v>> void add_to_substitution_map(types::substitution_map & substitution_map, const std::vector &symbols, diff --git a/include/deal.II/grid/tria_iterator.h b/include/deal.II/grid/tria_iterator.h index f5bff7a6f0..2474df0e8b 100644 --- a/include/deal.II/grid/tria_iterator.h +++ b/include/deal.II/grid/tria_iterator.h @@ -375,7 +375,7 @@ public: * Compare for equality. */ template - std::enable_if_t::value, bool> + std::enable_if_t, bool> operator==(const TriaRawIterator &) const; /** diff --git a/include/deal.II/grid/tria_iterator.templates.h b/include/deal.II/grid/tria_iterator.templates.h index 9a40d4f543..6ac6f47f93 100644 --- a/include/deal.II/grid/tria_iterator.templates.h +++ b/include/deal.II/grid/tria_iterator.templates.h @@ -83,8 +83,7 @@ TriaRawIterator::operator=(const TriaRawIterator &i) template template -inline std::enable_if_t::value, - bool> +inline std::enable_if_t, bool> TriaRawIterator::operator==( const TriaRawIterator &other) const { diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 1b15cdab58..dad59d7d26 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -1490,7 +1490,7 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> LinearOperator linear_operator(const OperatorExemplar &, Matrix &&) = delete; @@ -1500,8 +1500,7 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, - typename = - std::enable_if_t::value>, + typename = std::enable_if_t>, typename = std::enable_if_t< !std::is_same_v>>> LinearOperator @@ -1513,9 +1512,8 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, - typename = std::enable_if_t::value>, - typename = - std::enable_if_t::value>, + typename = std::enable_if_t>, + typename = std::enable_if_t>, typename = std::enable_if_t< !std::is_same_v>>> LinearOperator @@ -1526,7 +1524,7 @@ template < typename Domain = Range, typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename Matrix, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> LinearOperator linear_operator(const LinearOperator &, Matrix &&) = delete; @@ -1536,7 +1534,7 @@ template < typename Domain = Range, typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename Matrix, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> LinearOperator linear_operator(Matrix &&) = delete; @@ -1546,7 +1544,7 @@ template < typename Preconditioner, typename Range = typename Solver::vector_type, typename Domain = Range, - typename = std::enable_if_t::value>, + typename = std::enable_if_t>, typename = std::enable_if_t>, typename = std::enable_if_t< diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 60662d2b59..d1dcc6257e 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -168,14 +168,14 @@ namespace internal using size_type = types::global_dof_index; template - std::enable_if_t::value> + std::enable_if_t> zero_subrange(const size_type begin, const size_type end, T *dst) { std::memset(dst + begin, 0, (end - begin) * sizeof(T)); } template - std::enable_if_t::value> + std::enable_if_t> zero_subrange(const size_type begin, const size_type end, T *dst) { std::fill(dst + begin, dst + end, 0); @@ -219,7 +219,7 @@ SparseMatrix::operator=(const double d) grain_size); else if (matrix_size > 0) { - if constexpr (std::is_trivial::value) + if constexpr (std::is_trivial_v) std::memset(val.get(), 0, matrix_size * sizeof(number)); else std::fill(val.get(), val.get() + matrix_size, 0); diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 79b93d50d1..4cc7349507 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -212,7 +212,7 @@ namespace internal if (value == Number()) { - if constexpr (std::is_trivial::value) + if constexpr (std::is_trivial_v) { std::memset(dst + begin, 0, sizeof(Number) * (end - begin)); return; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index ee5b7ea18a..617670e347 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3153,7 +3153,7 @@ namespace internal { using BaseVectorType = typename ConstBlockVectorSelector< VectorType, - std::is_const::value>::BaseVectorType; + std::is_const_v>::BaseVectorType; static BaseVectorType * get_vector_component(VectorType &vec, const unsigned int component) diff --git a/include/deal.II/numerics/adaptation_strategies.h b/include/deal.II/numerics/adaptation_strategies.h index 3e05d83452..8147b25a29 100644 --- a/include/deal.II/numerics/adaptation_strategies.h +++ b/include/deal.II/numerics/adaptation_strategies.h @@ -229,7 +229,7 @@ namespace AdaptationStrategies & parent, const value_type parent_value) { - static_assert(std::is_arithmetic::value && + static_assert(std::is_arithmetic_v && !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -247,7 +247,7 @@ namespace AdaptationStrategies & parent, const value_type parent_value) { - static_assert(std::is_arithmetic::value && + static_assert(std::is_arithmetic_v && !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -289,7 +289,7 @@ namespace AdaptationStrategies sum(const typename dealii::Triangulation::cell_iterator &, const std::vector &children_values) { - static_assert(std::is_arithmetic::value && + static_assert(std::is_arithmetic_v && !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -308,7 +308,7 @@ namespace AdaptationStrategies const typename dealii::Triangulation::cell_iterator &, const std::vector &children_values) { - static_assert(std::is_arithmetic::value && + static_assert(std::is_arithmetic_v && !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); diff --git a/include/deal.II/numerics/history.h b/include/deal.II/numerics/history.h index cbc5574b0e..ceb6c94113 100644 --- a/include/deal.II/numerics/history.h +++ b/include/deal.II/numerics/history.h @@ -50,7 +50,7 @@ class FiniteSizeHistory { public: static_assert( - std::is_default_constructible::value, + std::is_default_constructible_v, "This class requires that the elements of type T are default constructible."); /** diff --git a/include/deal.II/optimization/rol/vector_adaptor.h b/include/deal.II/optimization/rol/vector_adaptor.h index f4a7a7b7dd..26f667570f 100644 --- a/include/deal.II/optimization/rol/vector_adaptor.h +++ b/include/deal.II/optimization/rol/vector_adaptor.h @@ -56,7 +56,7 @@ namespace Rol * VectorAdaptor::value_type itself is a type for real-valued numbers. * Therefore, VectorAdaptor supports vectors whose real_type is * convertible to value_type in the sense that - * std::is_convertible::value yields + * std::is_convertible_v yields * true. * * The VectorType should contain the following methods. @@ -125,7 +125,7 @@ namespace Rol */ using real_type = typename VectorType::real_type; - static_assert(std::is_convertible::value, + static_assert(std::is_convertible_v, "The real_type of the current VectorType is not " "convertible to the value_type."); diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index b29eadd3f6..46672d6bd7 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -482,7 +482,7 @@ namespace Particles */ template std::enable_if_t< - std::is_convertible *>::value == false> + std::is_convertible_v *> == false> set_particle_positions(const VectorType &input_vector, const bool displace_particles = true); @@ -1332,7 +1332,7 @@ namespace Particles template template inline std::enable_if_t< - std::is_convertible *>::value == false> + std::is_convertible_v *> == false> ParticleHandler::set_particle_positions( const VectorType &input_vector, const bool displace_particles) diff --git a/source/base/utilities.cc b/source/base/utilities.cc index c1a36d0573..32f1154714 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -487,9 +487,9 @@ namespace Utilities // https://en.cppreference.com/w/cpp/string/basic_string/to_string). So // resort to boost::lexical_cast for all other types (in // particular for floating point types. - std::string lc_string = (std::is_integral::value ? - std::to_string(value) : - boost::lexical_cast(value)); + std::string lc_string = + (std::is_integral_v ? std::to_string(value) : + boost::lexical_cast(value)); if ((digits != numbers::invalid_unsigned_int) && (lc_string.size() < digits)) diff --git a/source/base/vectorization.cc b/source/base/vectorization.cc index 7f161a66e9..a81179a3cb 100644 --- a/source/base/vectorization.cc +++ b/source/base/vectorization.cc @@ -23,11 +23,11 @@ DEAL_II_NAMESPACE_OPEN // and it is trivial (can be statically default initialized) // Here, the trait std::is_pod cannot be used because it is deprecated // in C++20. -static_assert(std::is_standard_layout>::value && - std::is_trivial>::value, +static_assert(std::is_standard_layout_v> && + std::is_trivial_v>, "VectorizedArray must be a POD type"); -static_assert(std::is_standard_layout>::value && - std::is_trivial>::value, +static_assert(std::is_standard_layout_v> && + std::is_trivial_v>, "VectorizedArray must be a POD type"); DEAL_II_NAMESPACE_CLOSE diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index e4b80d21af..457f72a6ff 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -57,7 +57,7 @@ namespace internal * std::abs on default types, but simply return the number on unsigned types. */ template - std::enable_if_t::value, + std::enable_if_t, typename numbers::NumberTraits::real_type> get_abs(const Number a) { @@ -65,7 +65,7 @@ namespace internal } template - std::enable_if_t::value, Number> + std::enable_if_t, Number> get_abs(const Number a) { return a; diff --git a/tests/base/array_view_08.cc b/tests/base/array_view_08.cc index 378b26608b..15d5f72a44 100644 --- a/tests/base/array_view_08.cc +++ b/tests/base/array_view_08.cc @@ -26,8 +26,8 @@ template constexpr bool is_const_reference() { - return std::is_reference::value && - std::is_const::type>::value; + return std::is_reference_v && + std::is_const_v::type>; } void @@ -40,9 +40,9 @@ test() AssertThrow(a.begin() == &v[4], ExcInternalError()); AssertThrow(a.end() == &v[7], ExcInternalError()); - static_assert(std::is_reference::value, + static_assert(std::is_reference_v, "type should be a reference"); - static_assert(std::is_reference::value, + static_assert(std::is_reference_v, "type should be a reference"); static_assert(!is_const_reference(), "type should not be const"); diff --git a/tests/base/array_view_09.cc b/tests/base/array_view_09.cc index b1445b265f..a1daab5d20 100644 --- a/tests/base/array_view_09.cc +++ b/tests/base/array_view_09.cc @@ -28,8 +28,8 @@ template constexpr bool is_const_reference() { - return std::is_reference::value && - std::is_const::type>::value; + return std::is_reference_v && + std::is_const_v::type>; } void @@ -77,9 +77,9 @@ test() std::fill(v.begin(), v.end(), 42.0); auto a = make_array_view(v.cbegin() + 2, v.cend()); // a needs to be ArrayView - static_assert(!std::is_const::value, + static_assert(!std::is_const_v, "a should not be const (but has const value)"); - static_assert(std::is_const::value, + static_assert(std::is_const_v, "a::value_type needs to be const"); static_assert(is_const_reference(), "type needs to be const"); @@ -101,9 +101,9 @@ test() // the type checking in that case #if BOOST_VERSION >= 106200 // a needs to be const ArrayView - static_assert(std::is_const::value, + static_assert(std::is_const_v, "a should not be const (but has const value)"); - static_assert(std::is_const::value, + static_assert(std::is_const_v, "a::value_type needs to be const"); static_assert(is_const_reference(), "type needs to be const"); diff --git a/tests/tensors/symmetric_tensor_36.cc b/tests/tensors/symmetric_tensor_36.cc index 6c4b821ebb..5736dd9ec3 100644 --- a/tests/tensors/symmetric_tensor_36.cc +++ b/tests/tensors/symmetric_tensor_36.cc @@ -34,7 +34,7 @@ template -std::enable_if_t::value, void> +std::enable_if_t, void> test_tensor_constructor(const std::string &, const std::string &) {} @@ -44,7 +44,7 @@ template -std::enable_if_t::value, void> +std::enable_if_t, void> test_tensor_constructor(const std::string &type1, const std::string &type2) { deallog << "Rank " << rank << ", "