Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83335 - in trunk/boost/multiprecision: . detail
From: e_float_at_[hidden]
Date: 2013-03-06 16:26:02


Author: christopher_kormanyos
Date: 2013-03-06 16:26:01 EST (Wed, 06 Mar 2013)
New Revision: 83335
URL: http://svn.boost.org/trac/boost/changeset/83335

Log:
Preliminary preparations for cpp_bin_float. Moved the rebind and dynamic_array structures from cpp_dec_float.hpp to separate files in /detail.
Added:
   trunk/boost/multiprecision/detail/dynamic_array.hpp (contents, props changed)
   trunk/boost/multiprecision/detail/rebind.hpp (contents, props changed)
Text files modified:
   trunk/boost/multiprecision/cpp_dec_float.hpp | 33 ++++-----------------------------
   1 files changed, 4 insertions(+), 29 deletions(-)

Modified: trunk/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_dec_float.hpp (original)
+++ trunk/boost/multiprecision/cpp_dec_float.hpp 2013-03-06 16:26:01 EST (Wed, 06 Mar 2013)
@@ -16,15 +16,16 @@
 #ifndef BOOST_MP_CPP_DEC_FLOAT_BACKEND_HPP
 #define BOOST_MP_CPP_DEC_FLOAT_BACKEND_HPP
 
-#include <boost/cstdint.hpp>
+#include <limits>
 #ifndef BOOST_NO_CXX11_HDR_ARRAY
 #include <array>
 #else
 #include <boost/array.hpp>
 #endif
+#include <boost/cstdint.hpp>
 #include <boost/multiprecision/number.hpp>
 #include <boost/multiprecision/detail/big_lanczos.hpp>
-#include <vector>
+#include <boost/multiprecision/detail/dynamic_array.hpp>
 
 //
 // Headers required for Boost.Math integration:
@@ -45,32 +46,6 @@
 
 namespace backends{
 
-namespace detail{
-
-template <class T, class Allocator>
-struct rebind
-{
- typedef typename Allocator::template rebind<T>::other type;
-};
-
-template <class T, unsigned S, class Allocator>
-struct dynamic_array : public std::vector<T, typename rebind<T, Allocator>::type>
-{
- dynamic_array()
- : std::vector<T, typename rebind<T, Allocator>::type>(static_cast<typename std::vector<T, typename rebind<T, Allocator>::type>::size_type>(S), static_cast<T>(0)) {}
-
- T* data()
- {
- return &*this->begin();
- }
- const T* data()const
- {
- return &*this->begin();
- }
-};
-
-}
-
 template <unsigned Digits10, class ExponentType, class Allocator>
 class cpp_dec_float
 {
@@ -2214,7 +2189,7 @@
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::operator = (long double a)
+cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::operator= (long double a)
 {
    // Christopher Kormanyos's original code used a cast to long long here, but that fails
    // when long double has more digits than a long long.

Added: trunk/boost/multiprecision/detail/dynamic_array.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/multiprecision/detail/dynamic_array.hpp 2013-03-06 16:26:01 EST (Wed, 06 Mar 2013)
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2013.
+// 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_DETAIL_DYNAMIC_ARRAY_HPP
+ #define BOOST_MP_DETAIL_DYNAMIC_ARRAY_HPP
+
+ #include <vector>
+ #include <boost/multiprecision/detail/rebind.hpp>
+
+ namespace boost { namespace multiprecision { namespace backends { namespace detail
+ {
+ template <class value_type, const boost::uint32_t elem_number, class my_allocator>
+ struct dynamic_array : public std::vector<value_type, typename rebind<value_type, my_allocator>::type>
+ {
+ dynamic_array() :
+ std::vector<value_type, typename rebind<value_type, my_allocator>::type>(static_cast<typename std::vector<value_type, typename rebind<value_type, my_allocator>::type>::size_type>(elem_number), static_cast<value_type>(0))
+ {
+ }
+
+ value_type* data() { return &(*(this->begin())); }
+ const value_type* data() const { return &(*(this->begin())); }
+ };
+ } } } } // namespace boost::multiprecision::backends::detail
+
+#endif // BOOST_MP_DETAIL_DYNAMIC_ARRAY_HPP

Added: trunk/boost/multiprecision/detail/rebind.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/multiprecision/detail/rebind.hpp 2013-03-06 16:26:01 EST (Wed, 06 Mar 2013)
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2013.
+// 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_DETAIL_REBIND_HPP
+ #define BOOST_MP_DETAIL_REBIND_HPP
+
+ namespace boost { namespace multiprecision { namespace backends { namespace detail
+ {
+ template <class value_type, class my_allocator>
+ struct rebind
+ {
+ typedef typename my_allocator::template rebind<value_type>::other type;
+ };
+ } } } } // namespace boost::multiprecision::backends::detail
+
+#endif // BOOST_MP_DETAIL_REBIND_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