|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80114 - in sandbox/big_number/boost/multiprecision: . detail traits
From: john_at_[hidden]
Date: 2012-08-21 11:47:33
Author: johnmaddock
Date: 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
New Revision: 80114
URL: http://svn.boost.org/trac/boost/changeset/80114
Log:
Add missing files, fix the worst of the GCC build failures.
Added:
sandbox/big_number/boost/multiprecision/traits/
sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp (contents, props changed)
sandbox/big_number/boost/multiprecision/traits/is_restricted_conversion.hpp (contents, props changed)
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 4 ++--
sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 5 +++++
sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
@@ -707,7 +707,7 @@
: base_type()
{
*this = static_cast<
- typename detail::canonical<
+ typename boost::multiprecision::detail::canonical<
typename cpp_int_backend<MinBits2, Signed2, Allocator2, true>::local_limb_type,
cpp_int_backend<MinBits, Signed, Allocator, false>
>::type
@@ -718,7 +718,7 @@
cpp_int_backend& operator=(const cpp_int_backend<MinBits2, Signed2, Allocator2, true>& other)
{
*this = static_cast<
- typename detail::canonical<
+ typename boost::multiprecision::detail::canonical<
typename cpp_int_backend<MinBits2, Signed2, Allocator2, true>::local_limb_type,
cpp_int_backend<MinBits, Signed, Allocator, false>
>::type
Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
@@ -813,6 +813,11 @@
eval_bitwise_xor(val, mask);
}
+template <class B>
+void eval_lcm(B& result, const B& a, const B& b);
+template <class B>
+void eval_gcd(B& result, const B& a, const B& b);
+
//
// These have to implemented by the backend, declared here so that our macro generated code compiles OK.
//
Modified: sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
@@ -112,7 +112,7 @@
template <class B>
inline void eval_lcm(B& result, const B& a, const B& b)
{
- typedef typename typename mpl::front<typename B::unsigned_types>::type ui_type;
+ typedef typename mpl::front<typename B::unsigned_types>::type ui_type;
B t;
eval_gcd(t, a, b);
Added: sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/boost/multiprecision/traits/explicit_conversion.hpp 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Vicente J. Botet Escriba 2009-2011
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MP_EXPLICIT_CONVERTIBLE_HPP
+#define BOOST_MP_EXPLICIT_CONVERTIBLE_HPP
+
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/declval.hpp>
+
+
+namespace boost{ namespace multiprecision{ namespace detail{
+
+template <int N>
+struct dummy_size{};
+
+template<typename S, typename T>
+struct is_explicitly_convertible_imp
+{
+#ifndef BOOST_NO_SFINAE_EXPR
+ template<typename S1, typename T1>
+ static type_traits::yes_type selector(dummy_size<sizeof(static_cast<T1>(declval<S1>()))>*);
+
+ template<typename S1, typename T1>
+ static type_traits::no_type selector(...);
+
+ static const bool value = sizeof(selector<S,T>(0)) == sizeof(type_traits::yes_type);
+
+ typedef boost::integral_constant<bool,value> type;
+#else
+ typedef typename boost::is_convertible<S, T>::type type;
+#endif
+};
+
+template<typename From, typename To>
+struct is_explicitly_convertible : public is_explicitly_convertible_imp<From, To>::type
+{
+};
+
+}}} // namespaces
+
+#endif
+
Added: sandbox/big_number/boost/multiprecision/traits/is_restricted_conversion.hpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/boost/multiprecision/traits/is_restricted_conversion.hpp 2012-08-21 11:47:32 EDT (Tue, 21 Aug 2012)
@@ -0,0 +1,48 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Vicente J. Botet Escriba 2009-2011
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MP_RESTRICTED_CONVERSION_HPP
+#define BOOST_MP_RESTRICTED_CONVERSION_HPP
+
+#include <boost/multiprecision/traits/explicit_conversion.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/multiprecision/detail/number_base.hpp>
+
+namespace boost{ namespace multiprecision{ namespace detail{
+
+
+template <class From, class To>
+struct is_lossy_conversion
+{
+ typedef typename mpl::if_c<
+ ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_integer))
+ || ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_rational))
+ || ((number_category<From>::value == number_kind_rational) && (number_category<To>::value == number_kind_integer))
+ || ((number_category<From>::value == number_kind_fixed_point) && (number_category<To>::value == number_kind_integer))
+ || (number_category<From>::value == number_kind_unknown)
+ || (number_category<To>::value == number_kind_unknown),
+ mpl::true_,
+ mpl::false_
+ >::type type;
+ static const bool value = type::value;
+};
+
+template<typename From, typename To>
+struct is_restricted_conversion
+{
+ typedef typename mpl::if_c<
+ ((is_explicitly_convertible<From, To>::value && !is_convertible<From, To>::value)
+ || is_lossy_conversion<From, To>::value),
+ mpl::true_,
+ mpl::false_
+ >::type type;
+ static const bool value = type::value;
+};
+
+}}} // namespaces
+
+#endif // BOOST_MP_RESTRICTED_CONVERSION_HPP
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk