]> git.donarmstrong.com Git - rsem.git/blobdiff - boost/math/tools/promotion.hpp
Updated boost to v1.55.0
[rsem.git] / boost / math / tools / promotion.hpp
index 83772f52e2a8c6a3c487984de4b06522089ce801..b3ad2040779e36e4b79e983abc2615647b598ba4 100644 (file)
@@ -33,6 +33,7 @@
 #include <boost/mpl/if.hpp> // for boost::mpl::if_c.
 #include <boost/mpl/and.hpp> // for boost::mpl::if_c.
 #include <boost/mpl/or.hpp> // for boost::mpl::if_c.
+#include <boost/mpl/not.hpp> // for boost::mpl::if_c.
 
 #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
 #include <boost/static_assert.hpp>
@@ -93,7 +94,7 @@ namespace boost
           >::type
           >::type,
           // else one or the other is a user-defined type:
-          typename mpl::if_< ::boost::is_convertible<T1P, T2P>, T2P, T1P>::type>::type type;
+          typename mpl::if_< typename mpl::and_<mpl::not_<is_floating_point<T2P> >, ::boost::is_convertible<T1P, T2P> >, T2P, T1P>::type>::type type;
       }; // promote_arg2
       // These full specialisations reduce mpl::if_ usage and speed up
       // compilation:
@@ -137,10 +138,35 @@ namespace boost
          //
          // Guard against use of long double if it's not supported:
          //
-         BOOST_STATIC_ASSERT((0 == ::boost::is_same<type, long double>::value));
+         BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented.");
 #endif
       };
 
+      //
+      // This struct is the same as above, but has no static assert on long double usage,
+      // it should be used only on functions that can be implemented for long double
+      // even when std lib support is missing or broken for that type.
+      //
+      template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
+      struct promote_args_permissive
+      {
+         typedef typename promote_args_2<
+            typename remove_cv<T1>::type,
+            typename promote_args_2<
+               typename remove_cv<T2>::type,
+               typename promote_args_2<
+                  typename remove_cv<T3>::type,
+                  typename promote_args_2<
+                     typename remove_cv<T4>::type,
+                     typename promote_args_2<
+                        typename remove_cv<T5>::type, typename remove_cv<T6>::type
+                     >::type
+                  >::type
+               >::type
+            >::type
+         >::type type;
+      };
+
     } // namespace tools
   } // namespace math
 } // namespace boost