|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73464 - in sandbox/e_float: boost/e_float libs/e_float/src/e_float libs/e_float/src/e_float/efx libs/e_float/test/real/cases
From: e_float_at_[hidden]
Date: 2011-07-31 10:27:35
Author: christopher_kormanyos
Date: 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
New Revision: 73464
URL: http://svn.boost.org/trac/boost/changeset/73464
Log:
- Restored compatibility with older compilers (std::string and pop_back, etc.
- Reworked linker digit-match guard check, also for older compilers.
Text files modified:
sandbox/e_float/boost/e_float/e_float_base.hpp | 19 ++++++++-----------
sandbox/e_float/boost/e_float/e_float_efx.hpp | 2 +-
sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp | 10 ++--------
sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp | 8 ++++----
sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp | 4 ++--
5 files changed, 17 insertions(+), 26 deletions(-)
Modified: sandbox/e_float/boost/e_float/e_float_base.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_base.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_base.hpp 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
@@ -43,6 +43,10 @@
#error The e_float type is undefined! Define the e_float type!
#endif
+ // Create a loud link error if the e_float headers mismatch a Lib or DLL.
+ template<const INT32 digits10> INT32 digits_match_lib_dll(void);
+ template<> INT32 digits_match_lib_dll<E_FLOAT_DIGITS10>(void);
+
class e_float_base
{
public:
@@ -158,21 +162,14 @@
static e_float my_cyl_bessel_jn(const INT32, const e_float&);
static e_float my_cyl_bessel_yn(const INT32, const e_float&);
- private:
-
- template<const INT32 digits10>
- struct digits_match_lib_dll
- {
- static INT32 value(void);
- };
-
- static bool digits_match_lib_dll_is_ok;
-
protected:
e_float_base()
{
- digits_match_lib_dll_is_ok = (digits_match_lib_dll<ef_digits10>::value() == ef_digits10);
+ digits_match_lib_dll_is_ok = (::digits_match_lib_dll<E_FLOAT_DIGITS10>() == E_FLOAT_DIGITS10);
}
+
+ private:
+ static bool digits_match_lib_dll_is_ok;
};
std::ostream& operator<<(std::ostream& os, const e_float_base& f);
Modified: sandbox/e_float/boost/e_float/e_float_efx.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_efx.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_efx.hpp 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
@@ -182,7 +182,7 @@
virtual void wr_string(std::string& str, std::ostream& os) const;
virtual bool rd_string(const char* const s);
- static void e_float::round_output_string(std::string& str, INT64& my_exp, const std::size_t number_of_digits);
+ static void round_output_string(std::string& str, INT64& my_exp, const std::size_t number_of_digits);
static void wr_string_scientific(std::string& str,
const INT64 my_exp,
Modified: sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
@@ -13,14 +13,8 @@
bool e_float_base::digits_match_lib_dll_is_ok;
-// The purpose of this template specialization is to create a loud
-// link error if the e_float headers are erroneously mismatched with
-// a library or DLL that has a different number of digits.
-template<>
-INT32 e_float_base::digits_match_lib_dll<e_float_base::ef_digits10>::value(void)
-{
- return e_float_base::ef_digits10;
-}
+// Create a loud link error if the e_float headers mismatch a Lib or DLL.
+template<> INT32 digits_match_lib_dll<e_float_base::ef_digits10>(void) { return e_float_base::ef_digits10; }
std::ostream& operator<<(std::ostream& os, const e_float_base& f)
{
Modified: sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
@@ -1672,9 +1672,9 @@
}
// Remove the trailing decimal point if necessary.
- if((str.back() == static_cast<char>('.')) && (!my_showpoint))
+ if((*(str.end() - 1u) == static_cast<char>('.')) && (!my_showpoint))
{
- str.pop_back();
+ str.erase(str.end() - 1u, str.end());
}
// Append the exponent in uppercase or lower case, including its sign.
@@ -1748,9 +1748,9 @@
}
// Remove the trailing decimal point if necessary.
- if((str.back() == static_cast<char>('.')) && (!my_showpoint))
+ if((*(str.end() - 1u) == static_cast<char>('.')) && (!my_showpoint))
{
- str.pop_back();
+ str.erase(str.end() - 1u, str.end());
}
}
Modified: sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp (original)
+++ sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp 2011-07-31 10:27:34 EDT (Sun, 31 Jul 2011)
@@ -37,8 +37,8 @@
std::string str_pi(str.begin(), str.begin() + (number_of_digits + 3u));
- bool b_round_up = (str_pi.back() >= static_cast<char>('5'));
- str_pi.pop_back();
+ const bool b_round_up = (*(str_pi.end() - 1u) >= static_cast<char>('5'));
+ str_pi.erase(str_pi.end() - 1u, str_pi.end());
if(b_round_up)
{
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