]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/math/tools/test_value.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / tools / test_value.hpp
index 3ae29a87b8c3f3a3d004ea0796bbc1bc2bf26d7d..2cdc1a02af19e877e9f34d7105aa900aebe7c755 100644 (file)
 // Macro BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE provides a global diagnostic value for create_type.
 
 #include <boost/cstdfloat.hpp> // For float_64_t, float128_t. Must be first include!
+#ifndef BOOST_MATH_STANDALONE
 #include <boost/lexical_cast.hpp>
-#include <boost/type_traits/is_constructible.hpp>
-#include <boost/type_traits/is_convertible.hpp>
+#endif
+#include <limits>
+#include <type_traits>
 
 #ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
 // global int create_type(0); must be defined before including this file.
@@ -46,7 +48,7 @@ typedef long double largest_float;
 #endif
 
 template <class T, class T2>
-inline T create_test_value(largest_float val, const char*, const boost::true_type&, const T2&)
+inline T create_test_value(largest_float val, const char*, const std::true_type&, const T2&)
 { // Construct from long double or quad parameter val (ignoring string/const char* str).
   // (This is case for MPL parameters = true_ and T2 == false_,
   // and  MPL parameters = true_ and T2 == true_  cpp_bin_float)
@@ -64,7 +66,7 @@ inline T create_test_value(largest_float val, const char*, const boost::true_typ
 }
 
 template <class T>
-inline T create_test_value(largest_float, const char* str, const boost::false_type&, const boost::true_type&)
+inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::true_type&)
 { // Construct from decimal digit string const char* @c str (ignoring long double parameter).
   // For example, extended precision or other User-Defined types which ARE constructible from a string
   // (but not from double, or long double without loss of precision).
@@ -76,15 +78,20 @@ inline T create_test_value(largest_float, const char* str, const boost::false_ty
 }
 
 template <class T>
-inline T create_test_value(largest_float, const char* str, const boost::false_type&, const boost::false_type&)
+inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::false_type&)
 { // Create test value using from lexical cast of decimal digit string const char* str.
   // For example, extended precision or other User-Defined types which are NOT constructible from a string
   // (NOR constructible from a long double).
-    // (This is case T1 = false_type and T2 == false_type).
-  #ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
+  // (This is case T1 = false_type and T2 == false_type).
+#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
   create_type = 3;
-  #endif
+#endif
+#if defined(BOOST_MATH_STANDALONE)
+  static_assert(sizeof(T) == 0, "Can not create a test value using lexical cast of string in standalone mode");
+  return T();
+#else
   return boost::lexical_cast<T>(str);
+#endif
 }
 
 // T real type, x a decimal digits representation of a floating-point, for example: 12.34.
@@ -107,12 +114,30 @@ inline T create_test_value(largest_float, const char* str, const boost::false_ty
 #define BOOST_MATH_TEST_VALUE(T, x) create_test_value<T>(\
   BOOST_MATH_TEST_LARGEST_FLOAT_SUFFIX(x),\
   #x,\
-  boost::integral_constant<bool, \
+  std::integral_constant<bool, \
+    std::numeric_limits<T>::is_specialized &&\
+      (std::numeric_limits<T>::radix == 2)\
+        && (std::numeric_limits<T>::digits <= BOOST_MATH_TEST_LARGEST_FLOAT_DIGITS)\
+        && std::is_convertible<largest_float, T>::value>(),\
+  std::integral_constant<bool, \
+    std::is_constructible<T, const char*>::value>()\
+)
+
+#if LDBL_MAX_10_EXP > DBL_MAX_10_EXP
+#define BOOST_MATH_TEST_HUGE_FLOAT_SUFFIX(x) BOOST_MATH_TEST_LARGEST_FLOAT_SUFFIX(x)
+#else
+#define BOOST_MATH_TEST_HUGE_FLOAT_SUFFIX(x) 0.0
+#endif
+
+#define BOOST_MATH_HUGE_TEST_VALUE(T, x) create_test_value<T>(\
+  BOOST_MATH_TEST_HUGE_FLOAT_SUFFIX(x),\
+  #x,\
+  std::integral_constant<bool, \
     std::numeric_limits<T>::is_specialized &&\
       (std::numeric_limits<T>::radix == 2)\
         && (std::numeric_limits<T>::digits <= BOOST_MATH_TEST_LARGEST_FLOAT_DIGITS)\
-        && boost::is_convertible<largest_float, T>::value>(),\
-  boost::integral_constant<bool, \
-    boost::is_constructible<T, const char*>::value>()\
+        && std::is_convertible<largest_float, T>::value>(),\
+  std::integral_constant<bool, \
+    std::is_constructible<T, const char*>::value>()\
 )
 #endif // TEST_VALUE_HPP