@@ -1711,55 +1711,11 @@ class type_parser<CharType,char> : public _type_parser_base<CharType>
1711
1711
};
1712
1712
1713
1713
#ifdef _WIN32
1714
- template <>
1715
- class type_parser <char , std::basic_string<wchar_t >> : public _type_parser_base<char >
1714
+ template <class CharType >
1715
+ class type_parser <CharType, std::enable_if_t < sizeof (CharType) == 1 , std:: basic_string<wchar_t >>> : public _type_parser_base<CharType >
1716
1716
{
1717
1717
public:
1718
- static pplx::task<std::wstring> parse (streams::streambuf<char > buffer)
1719
- {
1720
- return _parse_input<std::basic_string<char >,std::basic_string<wchar_t >>(buffer, _accept_char, _extract_result);
1721
- }
1722
-
1723
- private:
1724
- static bool _accept_char (const std::shared_ptr<std::basic_string<char >> &state, int_type ch)
1725
- {
1726
- if ( ch == concurrency::streams::char_traits<char >::eof () || isspace (ch)) return false ;
1727
- state->push_back (char (ch));
1728
- return true ;
1729
- }
1730
- static pplx::task<std::basic_string<wchar_t >> _extract_result (std::shared_ptr<std::basic_string<char >> state)
1731
- {
1732
- return pplx::task_from_result (utility::conversions::utf8_to_utf16 (*state));
1733
- }
1734
- };
1735
-
1736
- template <>
1737
- class type_parser <signed char ,std::basic_string<wchar_t >> : public _type_parser_base<signed char >
1738
- {
1739
- public:
1740
- static pplx::task<std::wstring> parse (streams::streambuf<signed char > buffer)
1741
- {
1742
- return _parse_input<std::basic_string<char >,std::basic_string<wchar_t >>(buffer, _accept_char, _extract_result);
1743
- }
1744
-
1745
- private:
1746
- static bool _accept_char (const std::shared_ptr<std::basic_string<char >> &state, int_type ch)
1747
- {
1748
- if ( ch == concurrency::streams::char_traits<char >::eof () || isspace (ch)) return false ;
1749
- state->push_back (char (ch));
1750
- return true ;
1751
- }
1752
- static pplx::task<std::basic_string<wchar_t >> _extract_result (std::shared_ptr<std::basic_string<char >> state)
1753
- {
1754
- return pplx::task_from_result (utility::conversions::utf8_to_utf16 (*state));
1755
- }
1756
- };
1757
-
1758
- template <>
1759
- class type_parser <unsigned char ,std::basic_string<wchar_t >> : public _type_parser_base<unsigned char >
1760
- {
1761
- public:
1762
- static pplx::task<std::wstring> parse (streams::streambuf<unsigned char > buffer)
1718
+ static pplx::task<std::wstring> parse (streams::streambuf<CharType> buffer)
1763
1719
{
1764
1720
return _parse_input<std::basic_string<char >,std::basic_string<wchar_t >>(buffer, _accept_char, _extract_result);
1765
1721
}
@@ -1781,3 +1737,4 @@ class type_parser<unsigned char,std::basic_string<wchar_t>> : public _type_parse
1781
1737
}}
1782
1738
1783
1739
#endif
1740
+
0 commit comments