fix std numeric conversions errors for GCC 5.1

This commit is contained in:
Jinhao 2015-12-15 15:51:29 +08:00
parent 2ac3b8128d
commit 1d9b75b1c2
3 changed files with 31 additions and 7 deletions

View File

@ -81,24 +81,36 @@
#define STD_CODECVT_NOT_SUPPORTED
#endif
#if (__GNUC__ == 4)
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
#define STD_THREAD_NOT_SUPPORTED
//boost.thread is preferred
//but if USE_github_com_meganz_mingw_std_threads is enabled,
//boost.thread will be replaced with meganz's mingw-std-threads.
// https://github.com/meganz/mingw-std-threads
//#define USE_github_com_meganz_mingw_std_threads
#define STD_TO_STRING_NOT_SUPPORTED
#endif
//_GLIBCXX_HAVE_BROKEN_VSWPRINTF is enabled to turn off all numeric conversions on MinGW(GCC 4)
#if defined(NANA_MINGW)
//It's a known issue under MinGW
//It's a knonwn issue under MinGW
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
#endif
#if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW))
#define STD_TO_STRING_NOT_SUPPORTED
#define STD_TO_WSTRING_NOT_SUPPORTED
#endif
#elif (__GNUC__ == 5)
#if defined(NANA_MINGW)
//The _GLIBCXX_HAVE_BROKEN_VSWPRINTF only applies to wide string
//It's a knonwn issue under MinGW
#define STD_TO_WSTRING_NOT_SUPPORTED
#endif
#endif
#endif

View File

@ -1,10 +1,10 @@
/*
* The Deploy Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* 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)
*
* @file: nana/deploy.hpp
@ -72,7 +72,12 @@ namespace std
std::string to_string(long long);
std::string to_string(unsigned long long);
std::string to_string(float);
}
#endif
#ifdef STD_TO_WSTRING_NOT_SUPPORTED
namespace std
{
std::wstring to_wstring(long double);
std::wstring to_wstring(double);
std::wstring to_wstring(unsigned);

View File

@ -298,6 +298,7 @@ namespace std
#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
#ifdef STD_TO_STRING_NOT_SUPPORTED
#include <sstream>
namespace std
{
std::string to_string(double v)
@ -362,7 +363,13 @@ namespace std
ss << v;
return ss.str();
}
}
#endif // STD_TO_STRING_NOT_SUPPORTED
#ifdef STD_TO_WSTRING_NOT_SUPPORTED
#include <sstream>
namespace std
{
std::wstring to_wstring(double v)
{
std::wstringstream ss;