Merge lexical_cast from trunk :

* force SunCC compiler to use fallback version of lexical_cast (with fallbak version SunCC can pass at least some tests)
* removed trailing whitespaces

[SVN r78565]
This commit is contained in:
Antony Polukhin
2012-05-24 04:22:04 +00:00
parent ca9c8d30bd
commit 79d6468aeb
11 changed files with 90 additions and 100 deletions
+25 -35
View File
@@ -69,12 +69,12 @@ namespace boost
{
// exception used to indicate runtime lexical_cast failure
class BOOST_SYMBOL_VISIBLE bad_lexical_cast :
// workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0
#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
public std::exception
#else
public std::bad_cast
#endif
// workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0
#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
public std::exception
#else
public std::bad_cast
#endif
#if defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x560 )
// under bcc32 5.5.1 bad_cast doesn't derive from exception
@@ -134,7 +134,7 @@ namespace boost
}
} // namespace boost
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC)
#include <cmath>
#include <istream>
@@ -147,9 +147,7 @@ namespace boost
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/range/iterator_range_core.hpp>
#if !defined(__SUNPRO_CC)
#include <boost/container/container_fwd.hpp>
#endif // !defined(__SUNPRO_CC)
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
#endif
@@ -170,13 +168,13 @@ namespace boost {
{
typedef CharT type;
};
template <>
struct widest_char< not_a_character_type, not_a_character_type >
{
typedef char type;
};
}
}
namespace detail // is_char_or_wchar<...> and stream_char<...> templates
{
@@ -243,7 +241,7 @@ namespace boost {
{
typedef BOOST_DEDUCED_TYPENAME stream_char<CharT*>::type type;
};
template<typename CharT>
struct stream_char<iterator_range<const CharT*> >
{
@@ -256,13 +254,11 @@ namespace boost {
typedef CharT type;
};
#if !defined(__SUNPRO_CC)
template<class CharT, class Traits, class Alloc>
struct stream_char< ::boost::container::basic_string<CharT, Traits, Alloc> >
{
typedef CharT type;
};
#endif // !defined(__SUNPRO_CC)
#if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T)
template<>
@@ -312,7 +308,6 @@ namespace boost {
typedef Traits type;
};
#if !defined(__SUNPRO_CC)
template<class CharT, class Traits, class Alloc, class Source>
struct deduce_char_traits< CharT
, ::boost::container::basic_string<CharT,Traits,Alloc>
@@ -366,7 +361,6 @@ namespace boost {
{
typedef Traits type;
};
#endif // !defined(__SUNPRO_CC)
}
namespace detail // lcast_src_length
@@ -436,7 +430,7 @@ namespace boost {
// -1.23456789e-123456
// ^ sign
// ^ leading digit
// ^ decimal point
// ^ decimal point
// ^^^^^^^^ lcast_precision<Source>::value
// ^ "e"
// ^ exponent sign
@@ -1389,7 +1383,6 @@ namespace boost {
return true;
}
#if !defined(__SUNPRO_CC)
template<class Alloc>
bool operator<<(::boost::container::basic_string<CharT,Traits,Alloc> const& str)
{
@@ -1397,7 +1390,7 @@ namespace boost {
finish = start + str.length();
return true;
}
#endif // !defined(__SUNPRO_CC)
bool operator<<(bool value)
{
CharT const czero = lcast_char_constants<CharT>::zero;
@@ -1410,14 +1403,14 @@ namespace boost {
{
start = rng.begin();
finish = rng.end();
return true;
return true;
}
bool operator<<(const iterator_range<const CharT*>& rng)
{
start = const_cast<CharT*>(rng.begin());
finish = const_cast<CharT*>(rng.end());
return true;
return true;
}
bool operator<<(const iterator_range<const signed char*>& rng)
@@ -1677,10 +1670,9 @@ namespace boost {
#endif
template<class Alloc>
bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; }
#if !defined(__SUNPRO_CC)
template<class Alloc>
bool operator>>(::boost::container::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; }
#endif // !defined(__SUNPRO_CC)
/*
* case "-0" || "0" || "+0" : output = false; return true;
@@ -1812,13 +1804,12 @@ namespace boost {
{
BOOST_STATIC_CONSTANT(bool, value = true );
};
#if !defined(__SUNPRO_CC)
template<typename CharT, typename Traits, typename Alloc>
struct is_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc> >
{
BOOST_STATIC_CONSTANT(bool, value = true );
};
#endif // !defined(__SUNPRO_CC)
template<typename Target, typename Source>
struct is_arithmetic_and_not_xchars
@@ -1866,11 +1857,11 @@ namespace boost {
};
// this metafunction evaluates to true, if we have optimized comnversion
// from Float type to Char array.
// this metafunction evaluates to true, if we have optimized comnversion
// from Float type to Char array.
// Must be in sync with lexical_stream_limited_src<Char, ...>::shl_real_type(...)
template <typename Float, typename Char>
struct is_this_float_conversion_optimized
struct is_this_float_conversion_optimized
{
typedef ::boost::type_traits::ice_and<
::boost::is_float<Float>::value,
@@ -1904,7 +1895,7 @@ namespace boost {
{
BOOST_STATIC_CONSTANT(bool, value = true );
};
#if !defined(__SUNPRO_CC)
template<typename CharT, typename Traits, typename Alloc>
struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, CharT* >
{
@@ -1916,7 +1907,6 @@ namespace boost {
{
BOOST_STATIC_CONSTANT(bool, value = true );
};
#endif // !defined(__SUNPRO_CC)
#if (defined _MSC_VER)
# pragma warning( push )
@@ -2262,10 +2252,10 @@ namespace boost {
template<typename Target, typename Source>
Target lexical_cast(Source arg)
{
typedef typename detail::widest_char<
BOOST_DEDUCED_TYPENAME detail::stream_char<Target>::type
, BOOST_DEDUCED_TYPENAME detail::stream_char<Source>::type
>::type char_type;
typedef typename detail::widest_char<
BOOST_DEDUCED_TYPENAME detail::stream_char<Target>::type
, BOOST_DEDUCED_TYPENAME detail::stream_char<Source>::type
>::type char_type;
typedef std::char_traits<char_type> traits;
detail::lexical_stream<Target, Source, traits> interpreter;