diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-18 02:38:23 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-18 03:12:02 +0300 |
commit | 25f39c16c2024bd7c9e03b4bc84625d0c8eed849 (patch) | |
tree | e00ddafc6d887c6f4d8c7fa709d51d0edea965d3 /src | |
parent | more convenience overloads (diff) | |
download | winapi-utf8-25f39c16c2024bd7c9e03b4bc84625d0c8eed849.tar.gz winapi-utf8-25f39c16c2024bd7c9e03b4bc84625d0c8eed849.zip |
much more type-safe & generic overloads
Diffstat (limited to 'src')
-rw-r--r-- | src/convert.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/convert.cpp b/src/convert.cpp index f3f0730..0d24424 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -86,10 +86,6 @@ std::wstring widen(const std::string& src) { return widen(src.c_str(), src.size()); } -std::wstring widen(const std::vector<unsigned char>& src) { - return widen(src.data(), src.size()); -} - std::wstring widen(const void* src, std::size_t in_nb) { const DWORD flags = MB_ERR_INVALID_CHARS; @@ -116,16 +112,8 @@ std::wstring widen(const void* src, std::size_t in_nb) { } std::string narrow(const std::wstring& src) { - return narrow(src.c_str(), src.size()); -} - -std::string narrow(const wchar_t* src, std::size_t nch) { static_assert(sizeof(wchar_t) == sizeof(WCHAR), "wchar_t != WCHAR"); - return narrow(src, nch * sizeof(wchar_t)); -} - -std::string narrow(const std::vector<unsigned char>& src) { - return narrow(src.data(), src.size()); + return narrow(src.c_str(), src.size() * sizeof(std::wstring::value_type)); } std::string narrow(const void* src, std::size_t in_nb) { |