aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/convert.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/convert.cpp b/src/convert.cpp
index 39485ee..f3f0730 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -116,8 +116,12 @@ std::wstring widen(const void* src, std::size_t in_nb) {
}
std::string narrow(const std::wstring& src) {
- static_assert(sizeof(std::wstring::value_type) == sizeof(WCHAR), "wchar_t != WCHAR");
- return narrow(src.c_str(), src.size() * sizeof(std::wstring::value_type));
+ 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) {