]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use std::is_floating_point_v instead of std::is_floating_point<...>::value. 15740/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 13 Jul 2023 18:15:11 +0000 (12:15 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 13 Jul 2023 18:15:11 +0000 (12:15 -0600)
include/deal.II/base/complex_overloads.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

index 2241ab9555b3e04835dc29b629ae39a0bbc3fbd8..a681029062b79dacbe4c3a3e4d1e57e6e12c861f 100644 (file)
@@ -38,7 +38,7 @@ struct ProductType;
  */
 template <typename T, typename U>
 inline std::enable_if_t<
-  std::is_floating_point<T>::value && std::is_floating_point<U>::value,
+  std::is_floating_point_v<T> && std::is_floating_point_v<U>,
   typename ProductType<std::complex<T>, std::complex<U>>::type>
 operator*(const std::complex<T> &left, const std::complex<U> &right)
 {
@@ -56,7 +56,7 @@ operator*(const std::complex<T> &left, const std::complex<U> &right)
  */
 template <typename T, typename U>
 inline std::enable_if_t<
-  std::is_floating_point<T>::value && std::is_floating_point<U>::value,
+  std::is_floating_point_v<T> && std::is_floating_point_v<U>,
   typename ProductType<std::complex<T>, std::complex<U>>::type>
 operator/(const std::complex<T> &left, const std::complex<U> &right)
 {
@@ -73,8 +73,8 @@ operator/(const std::complex<T> &left, const std::complex<U> &right)
  * @relatesalso ProductType
  */
 template <typename T, typename U>
-inline std::enable_if_t<std::is_floating_point<T>::value &&
-                          std::is_floating_point<U>::value,
+inline std::enable_if_t<std::is_floating_point_v<T> &&
+                          std::is_floating_point_v<U>,
                         typename ProductType<std::complex<T>, U>::type>
 operator*(const std::complex<T> &left, const U &right)
 {
@@ -90,8 +90,8 @@ operator*(const std::complex<T> &left, const U &right)
  * @relatesalso ProductType
  */
 template <typename T, typename U>
-inline std::enable_if_t<std::is_floating_point<T>::value &&
-                          std::is_floating_point<U>::value,
+inline std::enable_if_t<std::is_floating_point_v<T> &&
+                          std::is_floating_point_v<U>,
                         typename ProductType<std::complex<T>, U>::type>
 operator/(const std::complex<T> &left, const U &right)
 {
@@ -107,8 +107,8 @@ operator/(const std::complex<T> &left, const U &right)
  * @relatesalso ProductType
  */
 template <typename T, typename U>
-inline std::enable_if_t<std::is_floating_point<T>::value &&
-                          std::is_floating_point<U>::value,
+inline std::enable_if_t<std::is_floating_point_v<T> &&
+                          std::is_floating_point_v<U>,
                         typename ProductType<T, std::complex<U>>::type>
 operator*(const T &left, const std::complex<U> &right)
 {
@@ -124,8 +124,8 @@ operator*(const T &left, const std::complex<U> &right)
  * @relatesalso ProductType
  */
 template <typename T, typename U>
-inline std::enable_if_t<std::is_floating_point<T>::value &&
-                          std::is_floating_point<U>::value,
+inline std::enable_if_t<std::is_floating_point_v<T> &&
+                          std::is_floating_point_v<U>,
                         typename ProductType<T, std::complex<U>>::type>
 operator/(const T &left, const std::complex<U> &right)
 {
index 1856d0dfa4520aa1f98bc53bc0a527aea245e865..87ca9c557b36a6d26e07c5ae43b51cf326aa29b3 100644 (file)
@@ -252,7 +252,7 @@ struct is_same_as_any_of
  * do with something like
  * @code
  *   template <typename T>
- *   typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ *   typename std::enable_if<std::is_floating_point_v<T>, T>::type
  *   abs (const T t);
  * @endcode
  * which declares a function template `abs()` that can only be
@@ -284,7 +284,7 @@ struct enable_if_all
  * do with something like
  * @code
  *   template <typename T>
- *   std::enable_if_t<std::is_floating_point<T>::value, T>
+ *   std::enable_if_t<std::is_floating_point_v<T>, T>
  *   abs (const T t);
  * @endcode
  * which declares a function template `abs()` that can only be
index c10e2bb1d8620f26e6e4820622663b4083a10a85..77af2bd34413724661d12421c5489507f0a7a23e 100644 (file)
@@ -310,7 +310,7 @@ namespace Differentiation
                  (void)std::declval<typename ADNumberTrait::derivative_type>(),
                  void())>
         : std::conditional<
-            std::is_floating_point<typename ADNumberTrait::real_type>::value,
+            std::is_floating_point_v<typename ADNumberTrait::real_type>,
             std::false_type,
             std::true_type>::type
       {};
@@ -324,7 +324,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::none,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped                              = false;
         using real_type                                         = ScalarType;
@@ -339,9 +339,8 @@ namespace Differentiation
        * mechanism can be employed (e.g. Sacado types).
        */
       template <typename ScalarType>
-      struct Marking<
-        ScalarType,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+      struct Marking<ScalarType,
+                     std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         /**
          * Initialize the state of an independent variable.
@@ -533,9 +532,8 @@ namespace Differentiation
        * mechanism can be employed (e.g. Sacado types).
        */
       template <typename NumberType>
-      struct ExtractData<
-        NumberType,
-        std::enable_if_t<std::is_floating_point<NumberType>::value>>
+      struct ExtractData<NumberType,
+                         std::enable_if_t<std::is_floating_point_v<NumberType>>>
       {
         /**
          * Extract the floating point value.
@@ -647,7 +645,7 @@ namespace Differentiation
         static T
         value(const F &f,
               std::enable_if_t<is_ad_number<F>::value &&
-                               std::is_floating_point<T>::value> * = nullptr)
+                               std::is_floating_point_v<T>> * = nullptr)
         {
           // We recursively call this function in case the AD number is a
           // nested one. The recursion ends when the extracted value is
@@ -696,7 +694,7 @@ namespace Differentiation
         static std::complex<T>
         value(const F &f,
               std::enable_if_t<is_ad_number<F>::value &&
-                               std::is_floating_point<T>::value> * = nullptr)
+                               std::is_floating_point_v<T>> * = nullptr)
         {
           // We recursively call this function in case the AD number is a
           // nested one. The recursion ends when the extracted value is
@@ -745,7 +743,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<
            typename internal::RemoveComplexWrapper<ScalarType>::type>::value)>>
@@ -944,7 +942,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_taped =
@@ -958,7 +956,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_tapeless =
@@ -970,7 +968,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_real_valued =
@@ -982,7 +980,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_complex_valued =
@@ -994,7 +992,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::n_supported_derivative_levels =
@@ -1009,7 +1007,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_taped;
@@ -1020,7 +1018,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_tapeless;
@@ -1031,7 +1029,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_real_valued;
@@ -1042,7 +1040,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_complex_valued;
@@ -1053,7 +1051,7 @@ namespace Differentiation
       ScalarType,
       ADNumberTypeCode,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::n_supported_derivative_levels;
@@ -1076,7 +1074,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<
            typename internal::RemoveComplexWrapper<ScalarType>::type>::value)>>
@@ -1245,7 +1243,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_taped = false;
@@ -1256,7 +1254,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_tapeless = false;
@@ -1267,7 +1265,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_real_valued =
@@ -1279,7 +1277,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_complex_valued =
@@ -1291,7 +1289,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::n_supported_derivative_levels = 0;
@@ -1303,7 +1301,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_taped;
@@ -1314,7 +1312,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_tapeless;
@@ -1325,7 +1323,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_real_valued;
@@ -1336,7 +1334,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::is_complex_valued;
@@ -1347,7 +1345,7 @@ namespace Differentiation
       ScalarType,
       NumberTypes::none,
       std::enable_if_t<
-        std::is_floating_point<ScalarType>::value ||
+        std::is_floating_point_v<ScalarType> ||
         (boost::is_complex<ScalarType>::value &&
          std::is_floating_point<typename internal::RemoveComplexWrapper<
            ScalarType>::type>::value)>>::n_supported_derivative_levels;
@@ -1376,7 +1374,7 @@ namespace Differentiation
     template <typename ScalarType>
     struct ADNumberTraits<
       ScalarType,
-      std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+      std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       : NumberTraits<ScalarType, NumberTypes::none>
     {};
 
@@ -1388,7 +1386,7 @@ namespace Differentiation
       ComplexScalarType,
       std::enable_if_t<
         boost::is_complex<ComplexScalarType>::value &&
-        std::is_floating_point<typename ComplexScalarType::value_type>::value>>
+        std::is_floating_point_v<typename ComplexScalarType::value_type>>>
       : NumberTraits<ComplexScalarType, NumberTypes::none>
     {};
 
index c80230def3f64c292a7ab8a134c1c78a9627b82d..47b3a7c67078ae4865e80a5354be65e3c5ba27a6 100644 (file)
@@ -111,7 +111,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::adolc_taped,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped = true;
         using real_type            = adouble;
@@ -129,7 +129,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::adolc_tapeless,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped                              = false;
         using real_type                                         = adtl::adouble;
index 82112d1b3cec5c9536aa98794e3ddb18acd5a51d..1ddc22f0a7d611942cd347fe0057f6d93a593ee3 100644 (file)
@@ -200,7 +200,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::sacado_dfad,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped = false;
         using real_type            = Sacado::Fad::DFad<ScalarType>;
@@ -219,7 +219,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::sacado_dfad_dfad,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped = false;
         using real_type = Sacado::Fad::DFad<Sacado::Fad::DFad<ScalarType>>;
@@ -238,7 +238,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::sacado_rad,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped = false;
         using real_type            = Sacado::Rad::ADvar<ScalarType>;
@@ -257,7 +257,7 @@ namespace Differentiation
       struct ADNumberInfoFromEnum<
         ScalarType,
         Differentiation::AD::NumberTypes::sacado_rad_dfad,
-        std::enable_if_t<std::is_floating_point<ScalarType>::value>>
+        std::enable_if_t<std::is_floating_point_v<ScalarType>>>
       {
         static const bool is_taped = false;
         using real_type = Sacado::Rad::ADvar<Sacado::Fad::DFad<ScalarType>>;

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.