Fixes #6186 (lexical_cast compliation error fixed, when wchar_t is a typedef for unsigned short. Test added)

[SVN r75864]
This commit is contained in:
Antony Polukhin committed 2011-12-08 15:29:44 +00:00
1 parent 2312691bde
commit a9697b88fd
3 files changed
+69 -3

No files matched your search

+13 -2
View File
@@ -1093,6 +1093,8 @@ namespace boost
namespace detail // optimized stream wrapper
{
struct type_used_as_workaround_for_typedefed_wchar_ts{};
// String representation of Source has an upper limit.
template< class CharT // a result of widest_char transformation
, class Traits // usually char_traits<CharT>
@@ -1354,6 +1356,8 @@ namespace boost
/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/
private:
bool shr_unsigned(type_used_as_workaround_for_typedefed_wchar_ts /*var*/) {return true;}
template <typename Type>
bool shr_unsigned(Type& output)
{
@@ -1480,8 +1484,15 @@ namespace boost
}
/************************************ OPERATORS >> ( ... ) ********************************/
public:
bool operator>>(unsigned short& output) { return shr_unsigned(output); }
typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c<
::boost::is_same<CharT, unsigned short>::value
, type_used_as_workaround_for_typedefed_wchar_ts
, unsigned short
>::type ushort_ambiguity_workaround;
public:
bool operator>>(ushort_ambiguity_workaround& output){ return shr_unsigned(output); }
bool operator>>(unsigned int& output) { return shr_unsigned(output); }
bool operator>>(unsigned long int& output) { return shr_unsigned(output); }
bool operator>>(short& output) { return shr_signed(output); }