summaryrefslogtreecommitdiff
path: root/boost/multiprecision/detail/number_base.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/multiprecision/detail/number_base.hpp')
-rw-r--r--boost/multiprecision/detail/number_base.hpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/boost/multiprecision/detail/number_base.hpp b/boost/multiprecision/detail/number_base.hpp
index 9b10dd82d7..ca065bb569 100644
--- a/boost/multiprecision/detail/number_base.hpp
+++ b/boost/multiprecision/detail/number_base.hpp
@@ -38,8 +38,9 @@
//
// Thread local storage:
+// Note fails on Mingw, see https://sourceforge.net/p/mingw-w64/bugs/527/
//
-#if !defined(BOOST_NO_CXX11_THREAD_LOCAL) && !defined(BOOST_INTEL)
+#if !defined(BOOST_NO_CXX11_THREAD_LOCAL) && !defined(BOOST_INTEL) && !defined(__MINGW32__)
# define BOOST_MP_THREAD_LOCAL thread_local
#else
# define BOOST_MP_THREAD_LOCAL
@@ -364,13 +365,22 @@ struct unmentionable
typedef unmentionable* (unmentionable::*unmentionable_type)();
-template <class T>
-struct expression_storage
+template <class T, bool b>
+struct expression_storage_base
{
typedef const T& type;
};
template <class T>
+struct expression_storage_base<T, true>
+{
+ typedef T type;
+};
+
+template <class T>
+struct expression_storage : public expression_storage_base<T, boost::is_arithmetic<T>::value> {};
+
+template <class T>
struct expression_storage<T*>
{
typedef T* type;
@@ -988,6 +998,19 @@ template <class Backend, expression_template_option ExpressionTemplates>
struct number_category<number<Backend, ExpressionTemplates> > : public number_category<Backend>{};
template <class tag, class A1, class A2, class A3, class A4>
struct number_category<detail::expression<tag, A1, A2, A3, A4> > : public number_category<typename detail::expression<tag, A1, A2, A3, A4>::result_type>{};
+//
+// Specializations for types which do not always have numberic_limits specializations:
+//
+#ifdef BOOST_HAS_INT128
+template <>
+struct number_category<__int128> : public mpl::int_<number_kind_integer> {};
+template <>
+struct number_category<unsigned __int128> : public mpl::int_<number_kind_integer> {};
+#endif
+#ifdef BOOST_HAS_FLOAT128
+template <>
+struct number_category<__float128> : public mpl::int_<number_kind_floating_point> {};
+#endif
template <class T>
struct component_type;